3

We have a Kentico instance which stores media files in Azure blob storage. When uploading images of type SVG it's storing them with the default content type "application/octet-stream". This means they're not displaying correctly in the browser. The fix would be to use the correct content type "image/svg+xml". Does anyone know if it's possible to force Kentico to use this content type for SVG files?

I realise this can be done after upload using Powershell but that's a technical step not appropriate to roll out to content editors.

Tom Troughton
  • 3,941
  • 2
  • 37
  • 77

1 Answers1

7

You can add your own mime types to ~/App_Data/mimetypes.txt file. I just checked the source code and "application/octet-stream" is used as a default value when the mime type for extension is not found here.

The other thing to do might be to set Disposition of the response. By default the SVG images will be treated as attachments in the HTTP headers which means most browsers will try to download it instead of displaying. It seems that you might be able to fix this by using your own list with inline attachments. Try adding this to your web.config:

<add key="CMSGetFileDispositionInlineExtensions" value="pdf;swf;swg" />

It would we awesome if you could let me know if that helped!

Enn
  • 2,137
  • 15
  • 24
  • Amazing, it was your first advice that solved this. Added svg to mimetypes.txt, restart app, and subsequent uploads save in blob storage with correct content type. I'm extremely grateful, ta very much :) – Tom Troughton Sep 08 '16 at 12:06
  • Awesome, I'm happy it helped :-) – Enn Sep 08 '16 at 12:38