Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle empty xml:base #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Handle empty xml:base
  • Loading branch information
chrisguttandin committed Oct 20, 2023
commit ae7e4a048b1a7be15abf95e73ce46c282f3c1167
4 changes: 2 additions & 2 deletions lib/feedparser/index.js
Original file line number Diff line number Diff line change
@@ -240,7 +240,7 @@ FeedParser.prototype.handleCloseTag = function (el){
delete n['#prefix'];
delete n['#uri'];

if (this.xmlbase && this.xmlbase.length) {
if (this.xmlbase && this.xmlbase.length && this.xmlbase[0]['#'].trim() !== '') {
baseurl = this.xmlbase[0]['#'];
}

@@ -316,7 +316,7 @@ FeedParser.prototype.handleCloseTag = function (el){
this._emitted_meta = true;
}
}
if (!baseurl && this.xmlbase && this.xmlbase.length) { // handleMeta was able to infer a baseurl without xml:base or options.feedurl
if (!baseurl && this.xmlbase && this.xmlbase.length && this.xmlbase[0]['#'].trim() !== '') { // handleMeta was able to infer a baseurl without xml:base or options.feedurl
n = _.reresolve(n, this.xmlbase[0]['#']);
}
item = this.handleItem(n, this.meta['#type'], this.options);
Loading