Skip to content

Commit

Permalink
feat(routes): encode app URLs with percent encoding
Browse files Browse the repository at this point in the history
Ensure URLs are properly encoded to handle special characters.
  • Loading branch information
nekofar committed Sep 26, 2024
1 parent b087cfe commit 72541bc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/routes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use html_escape::encode_safe;
use html_minifier::minify;
use percent_encoding::{percent_encode, utf8_percent_encode, NON_ALPHANUMERIC};

Check warning on line 3 in src/routes.rs

View workflow job for this annotation

GitHub Actions / Build & Test

unused import: `percent_encode`

Check warning on line 3 in src/routes.rs

View workflow job for this annotation

GitHub Actions / Build & Test

unused import: `percent_encode`
use serde::{Deserialize, Serialize};
use serde_json::json;
use sqids::Sqids;
Expand Down Expand Up @@ -122,6 +123,8 @@ pub async fn handle_redirect<D>(req: Request, ctx: RouteContext<D>) -> worker::R
.as_str()
.replace(sqid, format!("app/{}", sqid).as_str());

let mini_app_url = utf8_percent_encode(&mini_app_url, NON_ALPHANUMERIC).to_string();

let html_doc = format!(
r#"
<!DOCTYPE html>
Expand Down

0 comments on commit 72541bc

Please sign in to comment.