Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: downloads url uploads on the server to allow for external url uploads #10004

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

PatrikKozak
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants