Don't keep looking for unsynced full-text content that isn't available

This can happen if cache files are deleted for PDF attachments or if
text files are missing.
This commit is contained in:
Dan Stillman 2017-07-26 05:39:30 -04:00
parent 10637ca9ea
commit 67ccb632b4
2 changed files with 40 additions and 16 deletions

View file

@ -229,7 +229,25 @@ describe("Zotero.Fulltext", function () {
assert.equal(d.indexedChars, toSync[pos].indexedChars);
assert.equal(d.indexedPages, toSync[pos].indexedPages);
}
})
});
it("should mark PDF attachment content as missing if cache file doesn't exist", function* () {
var item = yield importFileAttachment('test.pdf');
item.synced = true;
yield item.saveTx();
yield Zotero.Fulltext.indexItems([item.id]);
yield OS.File.remove(Zotero.Fulltext.getItemCacheFile(item).path);
var sql = "SELECT synced FROM fulltextItems WHERE itemID=?";
var synced = yield Zotero.DB.valueQueryAsync(sql, item.id);
assert.equal(synced, Zotero.Fulltext.SYNC_STATE_UNSYNCED);
yield Zotero.Fulltext.getUnsyncedContent(item.libraryID);
synced = yield Zotero.DB.valueQueryAsync(sql, item.id);
assert.equal(synced, Zotero.Fulltext.SYNC_STATE_MISSING);
});
})
describe("#setItemContent()", function () {