danmactough / node-feedparser

Robust RSS, Atom, and RDF feed parsing in Node.js
Other
1.97k stars 192 forks source link

Relative URLs in meta.image.url are not resolved #152

Closed maghoff closed 6 years ago

maghoff commented 8 years ago

Given the following test program:

var FeedParser = require('feedparser');

var fp = new FeedParser({feedurl: 'https://www.virtualbox.org/ticket/10860'});

fp.end('<?xml version="1.0"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Oracle VM VirtualBox: Ticket #10860: Full resolution not exposed to Linux guest</title><link>https://www.virtualbox.org/ticket/10860</link><description>description</description><language>en-us</language><image><title>Oracle VM VirtualBox</title><url>/graphics/vbox_logo2_gradient.png</url><link>https://www.virtualbox.org/ticket/10860</link></image><generator>Trac 0.12</generator></channel></rss>');

console.log(fp.meta.image.url);

I'd expect the output to be an absolute URL, in this case https://www.virtualbox.org/graphics/vbox_logo2_gradient.png. However, the output is merely the relative URL as written in the source feed: /graphics/vbox_logo2_gradient.png.

I might have wrong expectations to feedparser here, but I am expecting feedparser to resolve this URL because of the following text in README.md:

FeedParser is very good at resolving relative urls in feeds.

danmactough commented 8 years ago

Hmm. That's a valid expectation given the README if you don't hold all the history of RSS in your head. It's not explicit in the spec, but it's always been taken as a given that in RSS feeds, urls may not be relative. See e.g. http://www.rssboard.org/rss-profile#data-types-url

But I take your point.

maghoff commented 6 years ago

Sweet, thanks :slightly_smiling_face: