-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(storage-s3): dynamic presigned URL downloads #12706
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, I think we just need to mention it in the s3 adapter docs before we merge.
In the exampe in the docs I would write up an extension based example. I'm thinking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because shouldUseSignedURL
is already inside signedDownload
I wonder if we shouldn't just call it condition
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The consensus on our team is that this naming makes sense. 👍
Previously, if you enabled presigned URL downloads for a collection, all the files would use them. However, it might be possible that you want to use presigned URLs only for specific files (like videos), this PR allows you to pass `shouldUseSignedURL` to control that behavior dynamically. ```ts s3Storage({ collections: { media: { signedDownloads: { shouldUseSignedURL: ({ collection, filename, req }) => { return req.headers.get('X-Disable-Signed-URL') !== 'false' }, }, }, }, }) ```
🚀 This is included in version v3.43.0 |
Previously, if you enabled presigned URL downloads for a collection, all the files would use them. However, it might be possible that you want to use presigned URLs only for specific files (like videos), this PR allows you to pass
shouldUseSignedURL
to control that behavior dynamically.