🏠 back to Observable

SVG image in FileAttachment

Hi, I’ve experienced a strange behavior in https://observablehq.com/@severo/canvasimagesource. See the last cell. When the notebook is not published, I can see the image with

FileAttachment("SVG@1.svg").image()

But I get an error as soon as I publish the notebook:

Error: Unable to load file: SVG@1.svg

Hi @severo,

While I imagine you probably re-tested this already, just to confirm that the issue is reproducible:

2 Likes

Thanks for reporting and reproing! We have a fix in progress, but the problem occurs when we upload the file to S3; so files already uploaded will continue not to work after we deploy this fix and will need to wait for a backfill. I’ll update when we’ve deployed the fix so you can reupload the file to get it working in the meantime.

The issue is that sometimes we incorrectly set an xml content type on files that should be svg, which I believe our content security settings were then preventing from displaying.

3 Likes

This fix is deployed, if you reupload your SVG it should work correctly now.

We’re not going to backfill these to avoid changing behavior out from under anyone, but for anyone else experiencing this with SVG files uploaded before now downloading the file and reuploading it should give that file the correct content type.

4 Likes

Thanks for the quick fix and the explanation. It now works as expected.

1 Like