Issue displaying SVG in front end from Prismic media library

We have uploaded a SVG into the Prismic media library in the CMS, however when the SVG url is referenced in the frontend the file downloads instead of displaying. We have tried using other SVGs in our code from other sources and the SVGs work, could this be something on the amazon server Prismic is using to serve the file from?
Example file not working - https://prismic-io.s3.amazonaws.com/adaptavistv3/395fb71d-74fe-4946-a7fd-55858cda9598_flag_test.svg
Example file working - https://prismic-io.s3.amazonaws.com/wwwadaptavistcom/1adeae86-fc91-492e-88d5-ba39327d0a9b_flag.svg
(Note: contents of files are the same on both)

Hello Ian, thank you for reaching out and welcome to the forum!

I was able to see the problem with the file urls you sent me, however, this is most likely not related to how the file was stored in Prismic, but rather in the way the file was created. Some of these errors can occur when exporting from an editor like Photoshop or Illustrator. Take a look at this conversation that I found where this same topic is discussed, let me know if it is useful for you.

Hi

We've been looking at this again and still seem to be having an issue.

Both the exact same files but one has content-disposition: attachment (so it downloads on page load) but the other that works is set to content-disposition: inline

The file that works is working off another Prismic account but was uploaded a few months ago

We have also uploaded an SVG to our production environment and it has the same problem, when it was previously working fine.

I see, I'd need to further investigate this by taking a look at the Media gallery of each repo. Could you please share with me the URLs of your repos in a private dm?

Update

This is the new expected behaviour of SVG files hosted in Prismic.

This decision was made as a security measure. SVGs are vulnerable files that can have JS injected to them. So, from then on all SVG images will be treated as files.

if you have an SVG that does display instead of getting downloaded is because that file was uploaded before this new settings were implemented.

We explain this in detail in this Post.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.