1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix getLocationSearch when search and hash search exist

This commit is contained in:
Bill Thornton 2024-06-25 10:47:00 -04:00
parent 4ffa90cdd7
commit c89846c039
2 changed files with 68 additions and 2 deletions

View file

@ -5,13 +5,19 @@
* @returns The url search string.
*/
export const getLocationSearch = () => {
// Check location.hash for a search string (this should be the case for our routing library)
let index = window.location.hash.indexOf('?');
if (index !== -1) {
return window.location.hash.substring(index);
}
// Return location.search if it exists
if (window.location.search) {
return window.location.search;
}
// Check the entire url in case the search string is in the hash
const index = window.location.href.indexOf('?');
// Fallback to checking the entire url
index = window.location.href.indexOf('?');
if (index !== -1) {
return window.location.href.substring(index);
}