Compare commits

...

1 Commits

Author SHA1 Message Date
Greg Johnston 68a281f7ba fix: do not unescape / and other route characters when following a link 2024-06-28 12:42:35 -04:00
2 changed files with 6 additions and 1 deletions

View File

@ -435,7 +435,7 @@ impl RouterContextInner {
}
let url = Url::try_from(href.as_str()).unwrap();
let path_name = unescape(&url.pathname);
let path_name = crate::history::unescape_minimal(&url.pathname);
// let browser handle this event if it leaves our domain
// or our base path

View File

@ -28,6 +28,11 @@ pub fn unescape(s: &str) -> String {
js_sys::decode_uri_component(s).unwrap().into()
}
#[cfg(not(feature = "ssr"))]
pub fn unescape_minimal(s: &str) -> String {
js_sys::decode_uri(s).unwrap().into()
}
#[cfg(feature = "ssr")]
pub fn escape(s: &str) -> String {
percent_encoding::utf8_percent_encode(s, percent_encoding::NON_ALPHANUMERIC)