From e20b02c12446ad3cf25ce0a8c50e112257bbbac9 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Thu, 23 May 2024 10:46:08 -0400 Subject: [PATCH] Fix broken feeds due to rights fields missing in _textConstructs And warn instead of throwing in the future. Fixes #4162 --- chrome/content/zotero/xpcom/feedReader.js | 5 +++++ resource/feeds/FeedProcessor.js | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/chrome/content/zotero/xpcom/feedReader.js b/chrome/content/zotero/xpcom/feedReader.js index be2eb236b0..05b9e2e9d9 100644 --- a/chrome/content/zotero/xpcom/feedReader.js +++ b/chrome/content/zotero/xpcom/feedReader.js @@ -528,6 +528,11 @@ Zotero.FeedReader._getFeedItem = function (feedEntry, feedInfo) { * Convert HTML-formatted text to Zotero-compatible formatting */ Zotero.FeedReader._getRichText = function (feedText, field) { + if (typeof feedText === 'string') { + // FIXME: Don't expose TextConstructs on Feed/Entry objects so this bug can't happen + Zotero.debug(`FeedReader: Field ${field} was a string instead of a TextConstruct. Update the _textConstructs map.`); + return feedText; + } let domFragment = feedText.createDocumentFragment(); return Zotero.Utilities.trimInternal(domFragment.textContent); }; diff --git a/resource/feeds/FeedProcessor.js b/resource/feeds/FeedProcessor.js index d805ae81a7..3a745c74da 100644 --- a/resource/feeds/FeedProcessor.js +++ b/resource/feeds/FeedProcessor.js @@ -1008,6 +1008,10 @@ function FeedProcessor() { "atom03:summary": "text", "atom03:content": "text", "dc:title": "text", + "dc:rights": "text", + "atom03:rights": "text", + "copyright": "text", + "prism:copyright": "text", }; this._stack = [];