Fix URL encoding in search params within hash

This commit is contained in:
Martchus 2021-03-25 22:49:44 +01:00
parent caa235b412
commit 14d82a0a8d
1 changed files with 4 additions and 4 deletions

View File

@ -4,11 +4,11 @@ function initPackageSearch(sectionElement, sectionData, newParams)
const hasNewParams = newParams.length >= 1; const hasNewParams = newParams.length >= 1;
if (!hasNewParams) { if (!hasNewParams) {
if (currentParams !== undefined) { if (currentParams !== undefined) {
updateHashPreventingChangeHandler('#package-search-section' + currentParams); updateHashPreventingChangeHandler('#package-search-section?' + encodeURIComponent(currentParams));
} }
return true; return true;
} }
const searchParams = sections['package-search'].state.params = '?' + newParams[0]; const searchParams = sections['package-search'].state.params = newParams[0];
if (currentParams === searchParams) { if (currentParams === searchParams) {
return true; return true;
} }
@ -49,8 +49,8 @@ function searchForPackagesFromParams(searchParams)
function searchForPackages() function searchForPackages()
{ {
const res = startFormQueryEx('package-search-form', showPackageSearchResults); const res = startFormQueryEx('package-search-form', showPackageSearchResults);
const params = sections['package-search'].state.params = res.params; const params = sections['package-search'].state.params = res.params.substr(1);
updateHashPreventingSectionInitializer('#package-search-section' + params); updateHashPreventingSectionInitializer('#package-search-section?' + encodeURIComponent(params));
return res.ajaxRequest; return res.ajaxRequest;
} }