jpmonette / feed

A RSS, Atom and JSON Feed generator for Node.js, making content syndication simple and intuitive! 🚀
https://github.com/jpmonette/feed
MIT License
1.18k stars 197 forks source link

Incorrect mime types, e.g. `image/jpg`, should be `image/jpeg` #174

Open tuomassalo opened 2 years ago

tuomassalo commented 2 years ago

Describe the bug

If given e.g. https://example.com/foo.jpg, formatEnclosure gives type="image/jpg" instead of the correct MIME type image/jpeg.

I haven't checked which clients actually care about this.

To Reproduce

This behavior is already visible in the tests: https://github.com/jpmonette/feed/blob/fd77835d23990670975092c15009c75432e258ac/src/__tests__/__snapshots__/rss2.spec.ts.snap#L34

Expected behavior

The generated feed should contain:

<enclosure ... type="image/jpeg"/>

Actual behavior

The generated feed contains:

<enclosure ... type="image/jpg"/>

Versions (please complete the following information):

Additional context

The code at https://github.com/jpmonette/feed/blob/master/src/rss2.ts#L215-L223 returns the MIME type as image/[file_extension], which is correct for e.g. .png and .gif, but incorrect for e.g. .jpg and .svg.