FreshRSS / FreshRSS

A free, self-hostable news aggregator…
https://freshrss.org
GNU Affero General Public License v3.0
9.94k stars 850 forks source link

[Bug] Dynamic OPML re-creates feeds if OPML's xmlUrl is a redirect #6673

Open nie7321 opened 3 months ago

nie7321 commented 3 months ago

Describe the bug

For a Dynamic OPML category, if the OPML file includes a URL that returns a 301 Moved Permanently, then this feed is always muted & re-created.

It looks like FreshRSS_feed_Controller::actualizeFeeds() will update the feed's URL when it detects the redirect. Similar behaviour is not present in FreshRSS_Category::refreshDynamicOpml().

To Reproduce

Here is an example OPML feed: https://gist.github.com/nie7321/f7881db35c7ca52f43736dc312268d97 -- there are a few <outline> tags in here that exhibit the behaviour. Look at https://ahobbitsjourney.wordpress.com/feed as an example case for the repro steps below. When visited, this URL returns a 301 redirect for https://ahobbitsjourney.wordpress.com/feed/ (note the trailing slash).

  1. Add a Dynamic OPML feed that contains <outline xmlUrl="..."> tags with URLs that will return a 301 redirect.
  2. Let it load the feeds, and then let it load entries.
  3. Wait until the cronjob refreshes the dynamic OPML.
  4. Note that many feeds are now duplicated: a muted copy of the "original" feed loaded, and a brand-new copy with all entries unread.

Expected behavior

Match the feed URL update behaviour used when loading entries in the dynamic OPML refresh.

When loading a dynamic OPML, it should try to GET the feed. When it gets a 301 redirect response, and save the redirect location as the feed URL instead of what the OPML file reflects in xmlUrl.

FreshRSS version

1.24.1

Environment information

Additional context

No response

Neob91 commented 3 weeks ago

I encountered this issue when I added this OPML:

Screenshot 2024-10-26 at 19 15 46