aaronpk / XRay

X-Ray returns structured data from any URL
https://xray.p3k.app
MIT License
90 stars 15 forks source link

Relative img URL incorrectly resolved #98

Closed janboddez closed 4 years ago

janboddez commented 4 years ago

This is probably an mf2\resolveUrl issue, but I'm posting it here anyway ...

I'm using Aperture to keep track of https://victoria.dev/index.xml, and at least for this blog, relative (but non-root-relative---I think) images result in 404s.

One recent example is the post at https://victoria.dev/blog/how-to-choose-and-care-for-a-secure-open-source-project/. In there is an image with src="wheels.png" that should resolve to https://victoria.dev/blog/how-to-choose-and-care-for-a-secure-open-source-project/wheels.png but doesn't (I get https://victoria.dev/wheels.png, which doesn't exist).

As if somehow the base URL doesn't get set to, in this case, the page URL (itself ending in a trailing slash).

aaronpk commented 4 years ago

This is an xml file, so nothing to do with microformats.

I'm pretty sure RSS feeds aren't supposed to contain relative image URLs.

https://validator.w3.org/feed/docs/warning/ContainsRelRef.html

A quick google search suggests the solution is to fix it on the publishing end: https://www.google.com/search?q=relative+image+URLs+in+RSS+feeds

janboddez commented 4 years ago

Ah, that makes sense! I was under the impression RSS items got parsed much the same way, but I guess not. My mistake! Let's see if I can get the author to fix their feed, then.

aaronpk commented 4 years ago

If there were any semi-standard behavior around this I would consider fixing it on this end, but since the general consensus is that RSS feeds should have absolute URLs I'm not inclined to build a workaround for feeds like this. Hope that makes sense!