Resolve relative attachment URLs with proxy: false

4bc8fab4f5 added support for `proxy: false` on attachment URLs in
translators, but it made that flag skip `resolveURL()` altogether, which
meant that relative URLs weren't resolved, rather than just skipping
proxying.

This may fix PDF downloads for some ScienceDirect pages (though I can't
test this one):

https://forums.zotero.org/discussion/85884/problem-downloading-pdf-via-zotero
This commit is contained in:
Dan Stillman 2020-10-26 23:24:53 -04:00
parent daefc9c0ae
commit 9fdf82aca5

View file

@ -704,12 +704,15 @@ Zotero.Translate.Sandbox = {
delete attachment.path;
}
if (attachment.url && attachment.proxy !== false) {
if (attachment.url) {
// Remap attachment (but not link) URLs
// TODO: provide both proxied and un-proxied URLs (also for documents)
// because whether the attachment is attached as link or file
// depends on Zotero preferences as well.
attachment.url = translate.resolveURL(attachment.url, attachment.snapshot === false);
attachment.url = translate.resolveURL(
attachment.url,
attachment.proxy === false || attachment.snapshot === false
);
}
}
}