www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit d3833b8afd91fbed7b8c756b3d3cca82249bafe6
parent 126fb86957674327285e23386c4806bc6cfebc16
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed,  9 Aug 2017 02:39:20 +0200

Ignore stored-file path with no 'storage:'

There was a report of an imported file with a relative path, probably
from some ancient bug (in our code or a plugin's)

Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 14++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -2209,9 +2209,10 @@ Zotero.Item.prototype.getFilePath = function () { // Imported file with relative path if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL || linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) { - if (path.indexOf("storage:") == -1) { - Zotero.debug("Invalid attachment path '" + path + "'", 2); - throw new Error("Invalid path"); + if (!path.includes("storage:")) { + Zotero.logError("Invalid attachment path '" + path + "'"); + this._updateAttachmentStates(false); + return false; } // Strip "storage:" path = path.substr(8); @@ -2294,9 +2295,10 @@ Zotero.Item.prototype.getFilePathAsync = Zotero.Promise.coroutine(function* () { // Imported file with relative path if (linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL || linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) { - if (path.indexOf("storage:") == -1) { - Zotero.debug("Invalid attachment path '" + path + "'", 2); - throw new Error("Invalid path"); + if (!path.includes("storage:")) { + Zotero.logError("Invalid attachment path '" + path + "'"); + this._updateAttachmentStates(false); + return false; } // Strip "storage:"