use decodeURIComponent() to get ID from URL hash

This commit is contained in:
thawk
2021-07-30 22:36:37 +08:00
committed by Henrik Ingo
parent 63dba5f128
commit 4bceee7fd2
2 changed files with 4 additions and 2 deletions

View File

@@ -1204,7 +1204,8 @@
// Get id from url # by removing `#` or `#/` from the beginning,
// so both "fallback" `#slide-id` and "enhanced" `#/slide-id` will work
return byId( window.location.hash.replace( /^#\/?/, "" ) );
var encoded = window.location.hash.replace( /^#\/?/, "" );
return byId( decodeURIComponent( encoded ) );
};
// `getUrlParamValue` return a given URL parameter value if it exists

View File

@@ -46,7 +46,8 @@
// Get id from url # by removing `#` or `#/` from the beginning,
// so both "fallback" `#slide-id` and "enhanced" `#/slide-id` will work
return byId( window.location.hash.replace( /^#\/?/, "" ) );
var encoded = window.location.hash.replace( /^#\/?/, "" );
return byId( decodeURIComponent( encoded ) );
};
// `getUrlParamValue` return a given URL parameter value if it exists