From 206496332d12e9c84c05bd252a28d9f3df206439 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 6 Aug 2024 10:53:43 -0400 Subject: [PATCH] EPUB recognition: Fix DOI search results being thrown away https://forums.zotero.org/discussion/116524/epub-articles-and-books-not-getting-metadata-like-pdfs --- .../content/zotero/xpcom/recognizeDocument.js | 9 ++- test/tests/data/recognizeEPUB_test_DOI.epub | Bin 0 -> 26561 bytes test/tests/recognizeDocumentTest.js | 73 +++++++++++++++++- 3 files changed, 77 insertions(+), 5 deletions(-) create mode 100644 test/tests/data/recognizeEPUB_test_DOI.epub diff --git a/chrome/content/zotero/xpcom/recognizeDocument.js b/chrome/content/zotero/xpcom/recognizeDocument.js index e950da1ee8..43052592e8 100644 --- a/chrome/content/zotero/xpcom/recognizeDocument.js +++ b/chrome/content/zotero/xpcom/recognizeDocument.js @@ -624,14 +624,15 @@ Zotero.RecognizeDocument = new function () { saveAttachments: false }); if (searchItemJSON) { - if (search.ISBN && searchItemJSON?.ISBN?.split(' ') + itemJSON = searchItemJSON; + if (search.ISBN && searchItemJSON.ISBN && !searchItemJSON.ISBN.split(' ') .map(resolvedISBN => Zotero.Utilities.cleanISBN(resolvedISBN)) .includes(search.ISBN)) { - Zotero.debug('RecognizeDocument: Using ISBN search result'); - itemJSON = searchItemJSON; + Zotero.debug(`RecognizeDocument: ISBN mismatch (was ${search.ISBN}, got ${searchItemJSON.ISBN})`); + itemJSON = null; } else { - Zotero.debug(`RecognizeDocument: ISBN mismatch (was ${search.ISBN}, got ${searchItemJSON.ISBN})`); + Zotero.debug('RecognizeDocument: Using search result'); } } } diff --git a/test/tests/data/recognizeEPUB_test_DOI.epub b/test/tests/data/recognizeEPUB_test_DOI.epub new file mode 100644 index 0000000000000000000000000000000000000000..72d85321e05286f38e449be3abd069b25ccc1b44 GIT binary patch literal 26561 zcmY(qQ*bU!&@~#{Hg{~>wr$(Vj&0kvo$UCDZQHi3^M2ods?L8dx@u->`l4rgb@z0w zQIr7%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KeKVh{Vn9`;{zw|%q3m_N(jSV~<=f(6?l(&r z{wSisq4GZJxdLq^Fe-3EV*h@M*Pg;eJDT-i8&gG*y5t=HM?uSE)V_XSfA8ZT!lm@b zeD^6j_-d^@eReUbmbhj&s(zbZt!4e>u(;b(n!s3=PrKAel*q~OcEy=ysdr{kyGgdO z=OxT(WjAG*RkE5|doDd(F+!n`sVVZHk96~Jvi5ZHVp>6CIb{#KvEb=c*r0k-baZ2| z`oUw5AOEIB%>7n3`mS(XQu3DKxtON&kYxl~>oLJ~^!6KYU#sj^Rd@I9JNiIQu$Q-M z*6Uf?c$L^HeO=S}v%~tiysXD&YV+v$pl*`p7aW+P3^)V^Bn2c!HQ{hxv={zBLN(cS-MjsL%~ z6@O>=NB{qBr~em&JnX+P{LNhd?;QV0=l_f2N&bI0{;vA}JN)0(!oT3x%726ZuXgzF n_{3Dp>6BzuTNSa?}|9JZ^wo;5= literal 0 HcmV?d00001 diff --git a/test/tests/recognizeDocumentTest.js b/test/tests/recognizeDocumentTest.js index 9333700351..ee22d35201 100644 --- a/test/tests/recognizeDocumentTest.js +++ b/test/tests/recognizeDocumentTest.js @@ -11,6 +11,9 @@ describe("Document Recognition", function() { } before(function* () { + // Don't slow down attachment imports with indexing + Zotero.Prefs.set('fulltext.textMaxLength', 0); + this.timeout(60000); // Load Zotero pane and install PDF tools yield Zotero.Promise.all([ @@ -39,6 +42,8 @@ describe("Document Recognition", function() { }); after(function() { + Zotero.Prefs.clear('fulltext.textMaxLength'); + if (win) { win.close(); } @@ -368,8 +373,74 @@ describe("Document Recognition", function() { translateStub.restore(); }); + + it("should recognize an EPUB by DOI and rename the file", async function () { + let doi = '10.1177/20539517241232630'; + let search; + let translateStub = sinon.stub(Zotero.Translate.Search.prototype, 'translate') + .callsFake(async function () { + search = this.search; + return [{ + itemType: "journalArticle", + title: "Big AI: Cloud infrastructure dependence and the industrialisation of artificial intelligence", + publicationTitle: "Big Data & Society", + DOI: "10.1177/20539517241232630", + creators: [ + { + firstName: "Fernando", + lastName: "Van Der Vlist", + creatorType: "author" + }, + { + firstName: "Anne", + lastName: "Helmond", + creatorType: "author" + }, + { + firstName: "Fabian", + lastName: "Ferrari", + creatorType: "author" + } + ], + tags: [] + }]; + }); - it("should recognize an EPUB without an ISBN and rename the file", async function () { + let testDir = getTestDataDirectory(); + testDir.append('recognizeEPUB_test_DOI.epub'); + let attachment = await Zotero.Attachments.importFromFile({ file: testDir }); + + win.ZoteroPane.recognizeSelected(); + + let addedIDs = await waitForItemEvent('add'); + let modifiedIDs = await waitForItemEvent('modify'); + assert.isTrue(translateStub.calledOnce); + assert.ok(search); + assert.equal(search.DOI, doi); + assert.lengthOf(addedIDs, 1); + let item = Zotero.Items.get(addedIDs[0]); + assert.equal(item.getField('title'), 'Big AI: Cloud infrastructure dependence and the industrialisation of artificial intelligence'); + assert.equal(Zotero.Utilities.cleanDOI(item.getField('DOI')), doi); + assert.lengthOf(modifiedIDs, 2); + + await waitForProgressWindow(); + + // The file should have been renamed + assert.equal( + attachment.attachmentFilename, + Zotero.Attachments.getFileBaseNameFromItem(item) + '.epub' + ); + + // The title should have changed + assert.equal( + attachment.getField('title'), + Zotero.getString('file-type-ebook') + ); + + translateStub.restore(); + }); + + it("should recognize an EPUB without identifiers and rename the file", async function () { let testDir = getTestDataDirectory(); testDir.append('recognizeEPUB_test_DC.epub'); let attachment = await Zotero.Attachments.importFromFile({ file: testDir });