From 5eecc3fc54484feb4b2cfd4b27f67cdbd1c1692d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 20 May 2022 04:59:30 -0400 Subject: [PATCH] Add prefs for timeouts for downloading PDF via browser 1 second isn't enough for some users, so try 1.5, and allow for easier debugging via a pref. https://forums.zotero.org/discussion/96431/i-have-access-to-pdf-but-zotero-cannot-automatically-add-it https://forums.zotero.org/discussion/97277/unable-to-download-papers-using-zotero-chrome-extension --- chrome/content/zotero/xpcom/attachments.js | 4 ++-- defaults/preferences/zotero.js | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 61e34a3405..8cb616f68b 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -1137,9 +1137,9 @@ Zotero.Attachments = new function(){ */ this.downloadPDFViaBrowser = async function (url, path, options = {}) { Zotero.debug(`downloadPDFViaBrowser: Downloading file via browser from ${url}`); - const onLoadTimeout = 1e3; + const onLoadTimeout = Zotero.Prefs.get('downloadPDFViaBrowser.onLoadTimeout'); // Technically this is not a download, but the full operation timeout - const downloadTimeout = 60e3; + const downloadTimeout = Zotero.Prefs.get('downloadPDFViaBrowser.downloadTimeout'); let channelBrowser, hiddenBrowser; let hiddenBrowserPDFFoundDeferred = Zotero.Promise.defer(); diff --git a/defaults/preferences/zotero.js b/defaults/preferences/zotero.js index 962b3a2566..25fd72e871 100644 --- a/defaults/preferences/zotero.js +++ b/defaults/preferences/zotero.js @@ -77,6 +77,9 @@ pref("extensions.zotero.sortCreatorAsString", false); pref("extensions.zotero.tagSelector.showAutomatic", true); pref("extensions.zotero.tagSelector.displayAllTags", false); +pref("extensions.zotero.downloadPDFViaBrowser.onLoadTimeout", 1500); +pref("extensions.zotero.downloadPDFViaBrowser.downloadTimeout", 60000); + // Keyboard shortcuts pref("extensions.zotero.keys.saveToZotero", "S"); pref("extensions.zotero.keys.newItem", "N");