View Issue Details

IDProjectCategoryView StatusLast Update
0000344fileGeneralpublic2022-05-21 22:47
Reporterrven Assigned Tochristos  
PriorityhighSeveritymajorReproducibilityalways
Status feedbackResolutionopen 
OS VersionUbuntu 20.04.4 L 
Product Version5.41 
Summary0000344: image/svg+xml not correctly guessed from buffer
DescriptionWhen a svg needs to be parsed with the from_buffer method, it returns an incorrect mimetype when the <?xml version='1.0' encoding='UTF-8' ?> tag is included on top of the xml declaration
Steps To Reproduceimport magic
a = b"<svg height='180' width='180' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><rect fill='hsl(349, 60%, 45%)' height='180' width='180'/><text fill='#ffffff' font-size='96' text-anchor='middle' x='90' y='125' font-family='sans-serif'>M</text></svg>"
magic.from_buffer(a, mime=True)

=> 'image/svg+xml'

import magic
a = b"<?xml version='1.0' encoding='UTF-8' ?><svg height='180' width='180' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'><rect fill='hsl(349, 60%, 45%)' height='180' width='180'/><text fill='#ffffff' font-size='96' text-anchor='middle' x='90' y='125' font-family='sans-serif'>M</text></svg>"
magic.from_buffer(a, mime=True)

=> 'text/xml'
TagsNo tags attached.

Activities

christos

2022-05-21 22:47

manager   ~0003746

should be fixed in HEAD.

Issue History

Date Modified Username Field Change
2022-05-11 06:13 rven New Issue
2022-05-21 22:47 christos Assigned To => christos
2022-05-21 22:47 christos Status new => assigned
2022-05-21 22:47 christos Status assigned => feedback
2022-05-21 22:47 christos Note Added: 0003746