feed-normalizer icon indicating copy to clipboard operation
feed-normalizer copied to clipboard

Does not handle enclosures properly when falling back to SimpleRSS parser

Open droleary opened this issue 8 months ago • 0 comments

No movement here in well over a decade, so I'm going to make this a simple FYI bug report + workaround patch rather than a proper fix + pull request that might not go anywhere. Per the title, SimpleRSS doesn't process enclosures by default, and even adding the extensions to do so is not quite enough to match the object the standard RSS parser returns when parsing a valid feed (FeedNormalizer doesn't itself offer a substitute reference Enclosure object). A quick patch that fixes the problem for RSS feeds:

10a11,15
>   @@item_tags << :'enclosure#url'
>   @@item_tags << :'enclosure#length'
>   @@item_tags << :'enclosure#type'
> 
>   SimpleEnclosure = Struct.new(:url, :length, :type)
108a114
>         atomrss_entry.values_at(*%i[enclosure_url enclosure_length enclosure_type]).then {|enclosure_attributes| feed_entry.enclosures << SimpleRSS::SimpleEnclosure.new(*enclosure_attributes) if enclosure_attributes.all?}

No broken Atom podcasts in the wild for me yet, so I leave that additional fix to someone else.

droleary avatar Jun 24 '25 03:06 droleary