aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.59k stars 1.55k forks source link

Inconsistent Location in AWS.S3.ManagedUpload callback #1158

Closed fedot closed 7 years ago

fedot commented 7 years ago

AWS.S3.ManagedUpload callback may get Location property with url which has URI encoded pathname (/ replaced by %2F) if it's a multi-part upload.

This is response for a 6mb file upload: s3.upload(params).send(...)

{
  "Location": "https://stream-upload-tests.s3.amazonaws.com/stream-uploads%2Fkokoko.gif",
  "Bucket": "stream-upload-tests",
  "Key": "stream-uploads/kokoko.gif",
  "ETag": "\"e05220150932565fe8ccef113eed2d8a-2\""
}

This is response for uploading same file but with only one part: s3.upload(params,{partSize: 10 * 1024 * 1024, queueSize:1}).send(...)

{
  "ETag": "\"0a2ac29f85722128c5a55ababd53106a\"",
  "Location": "https://stream-upload-tests.s3.amazonaws.com/stream-uploads/kokoko2.gif",
  "key": "stream-uploads/kokoko2.gif",
  "Key": "stream-uploads/kokoko2.gif",
  "Bucket": "stream-upload-tests"
}
chrisradek commented 7 years ago

@fedot Thanks for reporting this. This inconsistency is happening because the multi-part upload returns the location URI encoded, whereas when the uploader does a putObject (single part) upload, we generate the Location ourselves.

We'll have to see what format the other SDKs return Location as, but we should be able to at least make it consistent across all upload calls.

ovaillancourt commented 7 years ago

Hi! Just wanted to mention that we've noted the same issue.

We're working around it by rebuilding the url from the Bucket and Key parts of the response as those are consistent.

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.