- 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
This commit is contained in:
parent
49632d6110
commit
9193ab3e62
3 changed files with 23 additions and 13 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue