Skip to content

Commit

Permalink
fix: allow decoding already-decoded URI components (closes #3606) (#3628
Browse files Browse the repository at this point in the history
)

* fix: allow decoding already-decoded URI components (closes #3606)

* clippy
  • Loading branch information
gbj authored Feb 19, 2025
1 parent 7c34b4a commit 6ecc681
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions router/src/location/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,20 @@ impl Url {

#[cfg(not(feature = "ssr"))]
{
js_sys::decode_uri_component(s).unwrap().into()
match js_sys::decode_uri_component(s) {
Ok(v) => v.into(),
Err(_) => s.into(),
}
}
}

pub fn unescape_minimal(s: &str) -> String {
#[cfg(not(feature = "ssr"))]
{
js_sys::decode_uri(s).unwrap().into()
match js_sys::decode_uri(s) {
Ok(v) => v.into(),
Err(_) => s.into(),
}
}

#[cfg(feature = "ssr")]
Expand Down

0 comments on commit 6ecc681

Please sign in to comment.