uppy
uppy copied to clipboard
[AWS S3 Uploader] Allow retrieving Object Version ID
Initial checklist
- [X] I understand this is a feature request and questions should be posted in the Community Forum
- [X] I searched issues and couldn’t find anything (or linked relevant results below)
Problem
AWS allows retrieving the version from versioning-enabled buckets with the x-amz-version-id
response header (Read more).
For multi-part uploads, I am able to retrieve the version ID because I control the response with completeMultipartUpload
. However, I am unable to retrieve this information while following the recommendation that files under 100 MiB are uploaded in a single chunk.
I would like to be able to access the version ID at the time the upload finishes for all upload types.
Solution
I think the easiest path would be to add versionId
as an optional field on UploadPartBytesResult
and populate in https://github.com/transloadit/uppy/blob/77c6b2512c5eae4bd95a6855d639cc428caba85f/packages/%40uppy/aws-s3-multipart/src/index.ts#L753
Alternatives
Always upload files in multiple parts, regardless of size
@aduh95 maybe it would be nice to let users control what is returned in both multipart and non-multipart, instead of hardcoding it?
I suppose we could use xhr.getAllResponseHeaders()
and pass the result directly to the user, which can then cherry-pick what they need from it. Do you think that would fulfil your usecase @ninanator?
I suppose it would only returns the headers that are allowed by CORS, but that's something the user controls.
@aduh95 @Murderlon
Returning all of the headers would be amazing!
To be honest, having a companion method like completeMultipartUpload
for uploads initiated via getUploadParameters
which has access to xhr.getAllResponseHeaders()
would be the absolute best because I could then normalize what comes back to the body
field of Success Response on the listener uppy.on('upload-success', ...)
across all upload types.