"Error While Saving Your Changes" with certain SVGs

I have created a new custom type with an image field.

When I try to use certain SVGs in the field I am unable to save the document.

I thought this thread may have been related: How to upload and use SVG?

But this error is consistent across both Firefox and Chrome.

After further investigation, it seems to be linked to whether or not there are explicit width and height properties on the svg. When missing, the error is triggered.

Workaround is to ensure there are explicit width and height properties on your svg.

When either is missing then that dimension is registered as 0px and results in a 400 error when trying to save the document. Would be really helpful if Prismic could add in a more helpful error here, even saying which field was preventing the save would have saved me a lot of time.

1 Like

Hi Joe,

Welcome to the Prismic community,
Thanks for sharing the workaround but in order to investigate this issue, can you please share with us the name of your repository (in a private message if necessary).

As well as the SVG you are trying to upload?

It would be also useful if you can add a screenshot of the error you get, and if you are a developer the error you get in your browser console.

Looking forward to your reply,
Fares

Hi @Fares,

Thanks for getting back to me.

Created a test repository at svgtest.prismic.io

Two SVGs attached that are identical except one has width/height properties and the other doesn't.
Test SVGs.zip (919 Bytes)

When I save the document with the SVG with no dimensions selected in the image field, all I get is a 400 response in the console.

When I save the document with the other SVG selected, the document saves.

Hi,
I've tried to reproduce the issue on my repository and I was able to upload save and publish both SVGs as shown

I will try to clone this test repo you have created to reproduce the issue.

That's interesting! When I upload the svg with no dimensions, the preview shows me "0 x 0px"

It seems that issue due to a browser issue in Firefox as far as I remember and seem a duplicate of the thread

I've tried the repo you have shared and I see the error but when I upload them again using chrome it works.

I still get this issue on Chrome in my test repo.

Screenshot 2020-11-19 at 16.17.04

Ah! My bad, that was using the asset uploaded through Firefox.

So to summarise: SVGs without width/height properties when uploaded through Firefox cannot be saved in documents (in any browser). So there appears to be an issue with the file upload process.

Okay here is the bug in Firefox:

1 Like

This issue has been closed due to inactivity. Flag to reopen.