Skip to content

Resolve relative feed image URLs against the feed URL #38

Open

Description

@coderabbitai

Describe the bug

When an image in the item HTML has a relative src (e.g. /images/article.jpg), the thumbnail is requested from the host of the page that contains the component instead of the host of the feed, so it fails to display when they differ.

The image is extracted by parsing the item HTML into a detached element and reading image.src, which resolves the URL against the page base. This happens in __getImageFromAttribute (rss-items.js) and in the image method injected from RssItems.java when extractImageFromDescription is enabled, for both description and encoded content.

Expected behavior

Relative image URLs are resolved against the feed URL (i.e. read the raw src attribute and resolve it with the feed URL as base). Absolute URLs remain unchanged, and an item without image still results in no image.

Additional information

Found during the review of #36 (#36 (comment)). The demo feed is not affected, since its image URLs are absolute.

Add-on Version

2.0.5-SNAPSHOT

Vaadin Version

25.3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions