SVG images are displayed as plain text
Added by Andrei Galea about 4 years ago
I recently upgraded our Redmine from 3.4 to 4.0. After this upgrade SVG Images are displayed as plain text when accessing the attachment link.
I tried to add the mime_type 'image/svg+xml'=> 'svg' in lib/redmine/mime_type.rb without any results.
Trying to reproduce this issue i added some logging output to the attachments_confroller.rb:
PNG or JPG Files:
attachment.is_text: false
attachment.is_image: true
SVG Files:
attachment.is_text: true
attachment.is_image: true
Since is_image is after is_text (elsif) the SVG is rendered as text. (https://github.com/redmine/redmine/blob/9fbbfd6017982645fb28872a54c1afd5584fb038/app/controllers/attachments_controller.rb#L59-L63)
Does anyone has any ideas how to solve this issue?