WeTransfer / format_parser

file metadata parsing, done cheap
https://rubygems.org/gems/format_parser
Other
62 stars 18 forks source link

Prevent MP3Parser parsing WebP files. #211

Closed Kevin-McGonigle closed 2 years ago

Kevin-McGonigle commented 2 years ago

We have an edge case where the MP3Parser is running and returning something "meaningful" for WebP files, causing them to be mislabled as MP3 files and incorrectly parsed. This PR adds protection against that edge case, similar to the protections added for similar cases with PNG and ZIP files.

enricoribelli commented 2 years ago

Now it does return the correct metadata when you run it locally (not through unit test) as we discussed in chat, right?

Kevin-McGonigle commented 2 years ago

Now it does return the correct metadata when you run it locally (not through unit test) as we discussed in chat, right?

@enricoribelli Yes, the behaviour is the same now whether you call WebpParser.call (as in unit tests) or FormatParser.parse (as in Peek and general use).