Media Picker with SVG in Umbraco 10

For the life of me I cannot retrieve an SVG (Vector Graphics (SVG)) in my views/models. I have created a picker (using Umbraco.MediaPicker3) with no restrictions. I have attached it to my document type.

I can create a content node, and pick a JPG. Works fine. Pick a PDF? Works fine. These all return a MediaWithCrops object. Pick an SVG? Returns null.

I can’t see any documentation about treating SVG differently. Any hints? The picker shows the SVG preview correctly:

If I do something like this:

var entry = (MyCustomModel)Model.Content;
var icon = entry.Icon;
var sourceValue = Model.Content.GetProperty("icon").GetSourceValue();

I can see for a random media entry (PDF in this case):
Visual Studio debug properties showing a valid icon and sourcevalue

And if I try the same again with an SVG, icon is now null but there is a SourceValue present:
Visual Studio debug properties showing a null icon but sourcevalue is present


This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/110560-media-picker-with-svg-in-umbraco-10

I just had the same issue with a V13 site. Uploading to a different folder worked.

I managed to get the original folder to work by:

  • Re-saving the folder
  • Re-saving the SVG
  • Reindexing Internal / External Examine indexes

I’m not sure which of the above resolved the issue, but after that, the SVG showed on the frontend