From 2e2a4bca7f5e3d98816f0a1ada690eefc8907393 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 27 Oct 2020 01:26:59 -0400 Subject: [PATCH] Follow automatic tags prefs when retrieving PDF metadata by ISBN https://forums.zotero.org/discussion/85777/retrieve-metadata-for-pdf-creates-automatic-tags-even-when-pref-is-off --- chrome/content/zotero/xpcom/recognizePDF.js | 29 ++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/chrome/content/zotero/xpcom/recognizePDF.js b/chrome/content/zotero/xpcom/recognizePDF.js index 528e41389c..ca77385eaa 100644 --- a/chrome/content/zotero/xpcom/recognizePDF.js +++ b/chrome/content/zotero/xpcom/recognizePDF.js @@ -504,18 +504,23 @@ Zotero.RecognizePDF = new function () { let newItem = new Zotero.Item; newItem.libraryID = libraryID; // Convert tags to automatic. For other items this is done automatically in - // translate.js for other items, but for ISBNs we just get the data - // (libraryID=false) and do the saving manually. - translatedItems[0].tags = translatedItems[0].tags.map(tag => { - if (typeof tag == 'string') { - return { - tag, - type: 1 - }; - } - tag.type = 1; - return tag; - }); + // translate.js, but for ISBNs we just get the data (libraryID=false) and do the + // saving manually. + if (Zotero.Prefs.get('automaticTags')) { + translatedItems[0].tags = translatedItems[0].tags.map(tag => { + if (typeof tag == 'string') { + return { + tag, + type: 1 + }; + } + tag.type = 1; + return tag; + }); + } + else { + translatedItems[0].tags = []; + } newItem.fromJSON(translatedItems[0]); if (!newItem.abstractNote && res.abstract) { newItem.setField('abstractNote', res.abstract);