Fix broken feeds due to rights fields missing in _textConstructs

And warn instead of throwing in the future.

Fixes #4162
This commit is contained in:
Abe Jellinek 2024-05-23 10:46:08 -04:00
parent 9325f773cc
commit e20b02c124
2 changed files with 9 additions and 0 deletions

View file

@ -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);
};

View file

@ -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 = [];