rust-syndication / rss

Library for serializing the RSS web content syndication format
https://crates.io/crates/rss
Apache License 2.0
419 stars 52 forks source link

iTunes extension not working while the extensions map does contain the respective information #158

Closed SamTV12345 closed 7 months ago

SamTV12345 commented 7 months ago

I use your crate which works really smooth in one of my projects: https://github.com/SamTV12345/PodFetch/issues/492 . Unfortunately the itunes extension doesn't work with one of the podcasts a user tried to download. Maybe you have an idea why the extensions map is filled with the image tag while the itunes_extensions shows None.

I created a reproducible here: https://gitlab.com/samtv12345/rss-crate-bug-report. Just run cargo run and you should see that itunes extension is none while the map contains the information. Do you have an idea why @andy128k ?

andy128k commented 7 months ago

Extensions are recognized by a namespace URI. iTunes URI in your example is http://www.itunes.com/DTDs/Podcast-1.0.dtd while the crate looks for http://www.itunes.com/dtds/podcast-1.0.dtd.

SamTV12345 commented 7 months ago

Wouldn't a toLowercase comparison solve the issue?

SamTV12345 commented 7 months ago

If you'd like to I can add a pull request for this. @andy128k

andy128k commented 7 months ago

Tough question. Formally URIs are case sensitive and such a change may be risky.

SamTV12345 commented 7 months ago

Good point. The question is will someone else create a schema that is equal to the iTunes url but change a character in the url to lower/uppercase. Probably not. So I think the chance of breaking an existing project using your library is very minimal.

andy128k commented 7 months ago

https://help.apple.com/itc/podcasts_connect/#/itcb54353390

Without this declaration, Podcasts Connect ignores all tags specific to Apple Podcasts. The namespace definition is case sensitive, and must be entered as shown.


It's not about someone creating a schema (that's unlikely and that should be someone with access to www.itunes.com domain).

But someone may create a feed with multiple namespaces:

<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:ITUNES="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version="2.0">
   <channel>
       <itunes:author>Author 1</itunes:author>
       <ITUNES:author>Author 2</ITUNES:author>
   </channel>
</rss>

Now we have an issue with merging formally two extensions into a single one. OTOH someone may create an alias like <rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:ITUNES="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"> and we still have this problem.

I'd say, this is much bigger issue than just add toLowercase.

andy128k commented 7 months ago

So, I reviewed the code and it seems that I overestimated the complexity. It looks a bit easier now #159.

SamTV12345 commented 7 months ago

Thank you for the changes 😃.