payload
payload copied to clipboard
feat: downloads url uploads on the server to allow for external url uploads
What?
Previously, the url uploads option only allowed using links from a users payload domain - which meant not being able to download images from a users browser without running into CORS errors
How?
Now, we download the image on the server first, and then stream it to the browser.
We do this by:
- opening a new payload endpoint called paste-url i.e
/api/paste-url
- this endpoint then accepts a query param for the image - i.e.
/api/paste-url?src=https://google.com/image.png
- the endpoint streams the src image back
- then, the paste URL function in the upload collection simply gets the image from that new Payload URL rather than directly, which would prevent CORS
TODO:
- Add tests