Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS file containing SVG incorrectly detected as SVG #107

Open
genezys opened this issue Jul 18, 2024 · 1 comment
Open

JS file containing SVG incorrectly detected as SVG #107

genezys opened this issue Jul 18, 2024 · 1 comment

Comments

@genezys
Copy link

genezys commented Jul 18, 2024

I recently encountered a JS file containing SVG code that is incorrectly detected as image/svg+xml instead of application/javascript.

Here is an illustration of the problem using an empty SVG image.

Marcel::MimeType.for StringIO.new(<<~JS)
window.el495_s4oco3nfv=`<?xml version="1.0" encoding="utf-8"?><svg version="1.1" xmlns="http://www.w3.org/2000/svg">...</svg>`;
JS
=> "image/svg+xml"
@zurchpet
Copy link

zurchpet commented Dec 10, 2024

I have the same issue with an Excel file that has <svg somewhere in the first 4096 bytes.

Marcel::MAGIC = Marcel::MAGIC.reject { |type, _| type == 'image/svg+xml' }

Is a workaround so it does not accidentally detect the file as image/svg+xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants