Cannot pipe SVGs in cloud storage plugin

default discord avatar
Alessio 🍣
6 months ago
1

When trying to pipe and SVG through the cloud storage plugin (see image, making my own domain serve an imagekit image), the resulting SVG is not displayed as SVG, but as code (see the images).



The SVG served from my domain is wrapped in a <pre></pre> while the one from the original domain is displayed directly



Solved it! It seems that the pipe method does not pipe the headers, especially content-type. A simple



res.setHeader('Content-Type', mapRes.headers['content-type']);

fixed it

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.