Find Full Text: Support Atypon (#4397)

Don't remove all query strings when normalizing URLs - keep 'download'
so that Atypon PDFs/EPUBs resolve correctly.
This commit is contained in:
Abe Jellinek 2024-07-16 11:15:12 -04:00 committed by Dan Stillman
parent 7020d60351
commit 629c5ecab2

View file

@ -1883,7 +1883,15 @@ Zotero.Attachments = new function () {
// Don't try the same normalized URL more than once
var triedURLs = new Set();
function normalizeURL(url) {
return url.replace(/\?.*/, '');
url = new URL(url);
for (let param of Array.from(url.searchParams.keys())) {
// Keep 'download' param for Atypon
if (param !== 'download') {
url.searchParams.delete(param);
}
}
url.searchParams.sort();
return url.toString();
}
function isTriedURL(url) {
return triedURLs.has(normalizeURL(url));