Feed import: Don't fail on OPML entry with no title
or text
https://forums.zotero.org/discussion/96841/impossible-dimporter-ompl-rss
This commit is contained in:
parent
603b843f71
commit
419f74379b
3 changed files with 8 additions and 3 deletions
|
@ -133,8 +133,9 @@ Zotero.Feeds = new function() {
|
|||
for (let feedElem of feedElems) {
|
||||
let url = feedElem.getAttribute('xmlUrl');
|
||||
if (!url) url = feedElem.getAttribute('url');
|
||||
let name = feedElem.getAttribute('title');
|
||||
if (!name) name = feedElem.getAttribute('text');
|
||||
let name = feedElem.getAttribute('title')
|
||||
|| feedElem.getAttribute('text')
|
||||
|| Zotero.getString('pane.collections.untitled');
|
||||
if (Zotero.Feeds.existsByURL(url) || registeredUrls.has(url)) {
|
||||
Zotero.debug("Feed Import from OPML: Feed " + name + " : " + url + " already exists. Skipping");
|
||||
continue;
|
||||
|
|
|
@ -14,5 +14,8 @@
|
|||
<outline type="rss" text="A title 3" title="A title 3" url="http://example.com/feed3.rss"/>
|
||||
<outline type="rss" text="A title 4" title="A title 4" url="http://example.com/feed4.rss"/>
|
||||
</outline>
|
||||
<outline text="Missing title">
|
||||
<outline type="rss" text="" title="" xmlUrl="http://example.com/feed5.rss"/>
|
||||
</outline>
|
||||
</body>
|
||||
</opml>
|
||||
|
|
|
@ -26,7 +26,8 @@ describe("Zotero.Feeds", function () {
|
|||
"http://example.com/feed1.rss": "A title 1",
|
||||
"http://example.com/feed2.rss": "A title 2",
|
||||
"http://example.com/feed3.rss": "A title 3",
|
||||
"http://example.com/feed4.rss": "A title 4"
|
||||
"http://example.com/feed4.rss": "A title 4",
|
||||
"http://example.com/feed5.rss": Zotero.getString('pane.collections.untitled')
|
||||
};
|
||||
yield Zotero.Feeds.importFromOPML(opmlString);
|
||||
let feeds = Zotero.Feeds.getAll();
|
||||
|
|
Loading…
Reference in a new issue