davros icon indicating copy to clipboard operation
davros copied to clipboard

HTML preview maybe should work with local images?

Open ocdtrekkie opened this issue 6 years ago • 2 comments

I host a website out of a Davros grain. It's a bit odd to me that when I preview the index.html file, it does render, yet fails to embed the image stored in the same folder in Davros. It's not a big deal as I can visit the publishing URL, it just seems odd to me that it doesn't work?

But then I kind of looked, and realized HTML files preview as "code", so I wondered if it rendering the HTML at all was a mistake...

ocdtrekkie avatar Mar 04 '20 19:03 ocdtrekkie

You're right, I think it was a mistake that it rendered at all. My general pattern for rendering previews of untrusted content is to xhr-fetch the contents and add them as srcdoc to a sandboxed iframe, and without allow-origin I'm not sure it'd be able to render relative images but can test it to see.

mnutt avatar Aug 13 '20 03:08 mnutt

Unfortunately I think this may end up out of scope; it may just be too hard to preview a page safely while allowing local images but disallowing remote image loads. But I can investigate it some more at a future date.

mnutt avatar Aug 19 '21 17:08 mnutt