1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2024-12-26 17:58:49 +00:00

webui: fix search encode in url hash. resolves #7265 (#7299)

This commit is contained in:
Diego Heras 2020-02-23 04:30:57 +01:00 committed by GitHub
parent 694c39503b
commit 5d808e006d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 4 deletions

View file

@ -51,7 +51,12 @@ $(document).ready(function () {
});
function openSearchIfNecessary() {
const hashArgs = location.hash.substring(1).split('&').reduce((prev, item) => Object.assign({ [item.split('=')[0]]: (item.split('=').length < 2 ? undefined : decodeURIComponent(item.split('=')[1])) }, prev), {});
const hashArgs = location.hash.substring(1).split('&').reduce((prev, item) =>
Object.assign({
[item.split('=')[0]]: (item.split('=').length < 2 ?
undefined :
decodeURIComponent(item.split('=')[1].replace(/\+/g,'%20')))
}, prev), {});
if ("search" in hashArgs) {
showSearch(hashArgs.tracker, hashArgs.search, hashArgs.category);
}
@ -775,7 +780,7 @@ function updateReleasesRow(row)
}
function showSearch(selectedIndexer, query, category) {
var selectedIndexers = []
var selectedIndexers = [];
if (selectedIndexer)
selectedIndexers = selectedIndexer.split(",");
$('#select-indexer-modal').remove();
@ -842,7 +847,11 @@ function showSearch(selectedIndexer, query, category) {
Tracker: releaseDialog.find('#searchTracker').val()
};
window.location.hash = $.param({ search: queryObj.Query, tracker: queryObj.Tracker.join(","), category: queryObj.Category.join(",") });
window.location.hash = Object.entries({
search: encodeURIComponent(queryObj.Query).replace(/%20/g,'+'),
tracker: queryObj.Tracker.join(","),
category: queryObj.Category.join(",")
}).map(([k, v], i) => k + '=' + v).join('&');
$('#jackett-search-perform').html($('#spinner').html());
$('#searchResults div.dataTables_filter input').val("");

View file

@ -691,6 +691,6 @@
</script>
<script type="text/javascript" src="../libs/api.js?changed=2017083001"></script>
<script type="text/javascript" src="../custom.js?changed=20200220"></script>
<script type="text/javascript" src="../custom.js?changed=20200222"></script>
</body>
</html>