From 9fdf82aca5fdc2ec3005dc273593061d8eac67e9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 26 Oct 2020 23:24:53 -0400 Subject: [PATCH] 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 --- chrome/content/zotero/xpcom/translation/translate.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index cdec61e735..594bb001e1 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -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 + ); } } }