www

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

commit 5f0aa6aa9fd12224d8fc25102c9776cc1c4bf38b
parent 675184d160c60b06ea7fb0085fadad90a76bf51f
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed,  8 Oct 2008 18:49:48 +0000

Better handling of missing attachments and empty attachment paths


Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 13+++++++++++--
Mchrome/content/zotero/xpcom/storage.js | 5+++--
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -1936,8 +1936,12 @@ Zotero.Item.prototype.numNotes = function() { /** -* Get the first line of the note for display in the items list -**/ + * Get the first line of the note for display in the items list + * + * Note: Note titles can also come from Zotero.Items.cacheFields()! + * + * @return {String} + */ Zotero.Item.prototype.getNoteTitle = function() { if (!this.isNote() && !this.isAttachment()) { throw ("getNoteTitle() can only be called on notes and attachments"); @@ -2127,6 +2131,11 @@ Zotero.Item.prototype.getFile = function(row, skipExistsCheck) { return false; } + if (!row.path) { + Zotero.debug("Attachment path is empty", 2); + return false; + } + if (row.linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_URL || row.linkMode == Zotero.Attachments.LINK_MODE_IMPORTED_FILE) { try { diff --git a/chrome/content/zotero/xpcom/storage.js b/chrome/content/zotero/xpcom/storage.js @@ -1083,8 +1083,9 @@ Zotero.Sync.Storage = new function () { var file = item.getFile(); if (!file) { - _error("File " + file.leafName + " not found for item " - + itemID + " after extracting ZIP"); + _removeRequest(request); + _queueAdvance('download', Zotero.Sync.Storage.downloadFile, true); + _error("File not found for item " + item.id + " after extracting ZIP"); } file.lastModifiedTime = syncModTime * 1000;