www

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

commit 14ecf88ad475d0da7a8c9b78318e84583a119186
parent 4137a61bc8c7dcc88745a71edcc861958fb8f4c0
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 31 Oct 2017 22:03:05 -0400

Don't return unparsed Mac persistent descriptor from Item.getFilePath()

And auto-convert to path, not filename

Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -2191,13 +2191,21 @@ Zotero.Item.prototype.getFilePath = function () { // // These should only exist if they weren't converted in the 80 DB upgrade step because // the file couldn't be found. - if (Zotero.isMac && path.startsWith('AAAA')) { + if (path.startsWith('AAAA')) { + // These can only be resolved on Macs + if (!Zotero.isMac) { + Zotero.debug(`Can't resolve old-style attachment path '${path}' on non-Mac platform`); + this._updateAttachmentStates(false); + return false; + } + let file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); try { file.persistentDescriptor = path; } catch (e) { + Zotero.debug(`Can't resolve old-style attachment path '${path}'`); this._updateAttachmentStates(false); return false; } @@ -2205,7 +2213,7 @@ Zotero.Item.prototype.getFilePath = function () { // If valid, convert this to a regular string in the background Zotero.DB.queryAsync( "UPDATE itemAttachments SET path=? WHERE itemID=?", - [file.leafName, this._id] + [file.path, this._id] ); return file.path;