www

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

commit 9193ab3e62dbdb5cdb037872089e4767576d1984
parent 49632d6110961ff6b2a3ffd67b9c47629a7bc31c
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 27 Jan 2010 09:47:08 +0000

- Fix Zotero crash attempting to index an unindexable link attachment twice
- Log error on index failure, and include note about filenames with extended characters if applicable


Diffstat:
Mchrome/content/zotero/overlay.js | 13+++----------
Mchrome/content/zotero/xpcom/attachments.js | 16++++++++++++++--
Mchrome/content/zotero/xpcom/fulltext.js | 7++++++-
3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/chrome/content/zotero/overlay.js b/chrome/content/zotero/overlay.js @@ -1230,18 +1230,11 @@ var ZoteroPane = new function() function reindexItem() { - var items = this.getSelectedItems(); - if (!items) { + var itemIDs = this.getSelectedItems(true); + if (!itemIDs) { return; } - - for (var i=0; i<items.length; i++) { - if (!items[i].isAttachment()) { - continue; - } - var itemID = items[i].id; - Zotero.Fulltext.indexItems(itemID, true); - } + Zotero.Fulltext.indexItems(itemIDs, true); document.getElementById('zotero-attachment-box').updateItemIndexedState(); } diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js @@ -1186,12 +1186,24 @@ Zotero.Attachments = new function(){ dir = dir.clone(); + // If directory is empty or has only hidden files, delete it var files = dir.directoryEntries; files.QueryInterface(Components.interfaces.nsIDirectoryEnumerator); - if (!files.hasMoreElements()) { - dir.remove(false); + var empty = true; + while (files.hasMoreElements()) { + var file = files.getNext(); + file.QueryInterface(Components.interfaces.nsIFile); + if (file.leafName[0] == '.') { + continue; + } + empty = false; + break; } files.close(); + if (empty) { + dir.remove(true); + return; + } // Create orphaned-files directory if it doesn't exist var orphaned = Zotero.getZoteroDirectory(); diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js @@ -462,7 +462,12 @@ Zotero.Fulltext = new function(){ } if (!cacheFile.exists()) { - Zotero.debug("Cache file doesn't exist!"); + var msg = file.leafName + " was not indexed"; + if (!file.leafName.match(/^[\u0000-\u007F]$/)) { + msg += " -- PDFs with filenames containing extended characters cannot currently be indexed due to a Firefox limitation"; + } + Zotero.debug(msg, 2); + Components.utils.reportError(msg); return false; }