You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the HTML has a comment before the opening tag, it is incorrectly identified as XML.
Steps to reproduce
io=StringIO.new(<<~HTML)<!--/* Throwaway comment but it has to be over 64 characters to fail AND have a uppercase HTML tag */--><HTML><head></head><body><h1>Magic!</h1></body</HTML>HTMLMarcel::MimeType.for(io)# => "application/xml"
io=StringIO.new(<<~HTML)<!--/* Throwaway comment but it has to be over 128 characters to fail AND have a lowercase HTML tag, we can pad this one out a bit to get it longer */--><html><head></head><body><h1>Magic!</h1></body</html>HTMLMarcel::MimeType.for(io)# => "application/xml"
If the HTML has a comment before the opening tag, it is incorrectly identified as XML.
Steps to reproduce
Updating the magic definitions is a temporary workaround but obviously the comment could be any length, the broader lookup here https://github.com/rails/marcel/blob/main/lib/marcel/tables.rb#L2761 falls below the comment xml matching magic in https://github.com/rails/marcel/blob/main/lib/marcel/tables.rb#L2747.
Temporary workaround
The text was updated successfully, but these errors were encountered: