rails / marcel

Find the mime type of files, examining file, filename and declared type
Apache License 2.0
386 stars 67 forks source link

Incorrect XML magic identification when <title tag present #110

Open IBazylchuk opened 1 month ago

IBazylchuk commented 1 month ago

If the XML has a <title tag, it is incorrectly identified as XML.

This behavior has been changed in this pull request https://github.com/rails/marcel/pull/74/files#diff-1fc2f7a3e2d7dad99c84d6f99f9eb59b810e6fde227789b70fa450163c39ee52R2402

Steps to reproduce


xml = %{<?xml version="1.0" encoding="UTF-8"?><source><jobs><job><title><![CDATA[Test tiltle]]></title><city><![CDATA[Boston]]></city><state><![CDATA[MA]]></state><zip/><country><![CDATA[USA]]></country></job></jobs></source>}

Marcel::Magic.by_magic(xml).type

# => "text/html"