EPUB indexing: Skip if textMaxLength is 0

Like we do for PDFs already.
This commit is contained in:
Abe Jellinek 2024-08-06 11:00:38 -04:00
parent 151218e4de
commit c1f681a228
2 changed files with 12 additions and 0 deletions

View file

@ -412,6 +412,9 @@ Zotero.Fulltext = Zotero.FullText = new function(){
const { EPUB } = ChromeUtils.import('chrome://zotero/content/EPUB.jsm'); const { EPUB } = ChromeUtils.import('chrome://zotero/content/EPUB.jsm');
let maxLength = Zotero.Prefs.get('fulltext.textMaxLength'); let maxLength = Zotero.Prefs.get('fulltext.textMaxLength');
if (maxLength === 0) {
return false;
}
let item = await Zotero.Items.getAsync(itemID); let item = await Zotero.Items.getAsync(itemID);
let epub = new EPUB(filePath); let epub = new EPUB(filePath);

View file

@ -66,6 +66,15 @@ describe("Zotero.FullText", function () {
); );
}) })
it("should skip indexing of an EPUB if fulltext.textMaxLength is 0", function* () {
Zotero.Prefs.set('fulltext.textMaxLength', 0);
var item = yield importFileAttachment('recognizeEPUB_test_content.epub');
assert.equal(
(yield Zotero.Fulltext.getIndexedState(item)),
Zotero.Fulltext.INDEX_STATE_UNINDEXED
);
});
describe("Indexing with HiddenBrowser", () => { describe("Indexing with HiddenBrowser", () => {
it("should index attachment as its attachmentContentType when supported", async function () { it("should index attachment as its attachmentContentType when supported", async function () {
// Firefox would normally load this as text/x-shellscript, but we detect text/plain // Firefox would normally load this as text/x-shellscript, but we detect text/plain