Skip to content

Does not handle enclosures properly when falling back to SimpleRSS parser #9

@droleary

Description

@droleary

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions