Fix: Small fix for location hash/fragment (#2464)

This commit is contained in:
Bart Toersche 2024-03-27 07:45:29 +01:00 committed by GitHub
parent f3d19ca744
commit 73b8c7872e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -39,7 +39,10 @@ pub fn location_hash() -> Option<String> {
if is_server() {
None
} else {
location().hash().ok().map(|hash| hash.replace('#', ""))
location().hash().ok().map(|hash| match hash.chars().next() {
Some('#') => hash[1..].to_string(),
_ => hash,
})
}
}