Better handling of missing attachments and empty attachment paths

This commit is contained in:
Dan Stillman 2008-10-08 18:49:48 +00:00
parent 675184d160
commit 5f0aa6aa9f
2 changed files with 14 additions and 4 deletions

View file

@ -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 {

View file

@ -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;