Преглед изворни кода

Merge pull request #886 from transloadit/fix/s3-upload-url

s3: Fix uploadURL for presigned PUT uploads
Artur Paikin пре 6 година
родитељ
комит
98f7c4b47f
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      src/plugins/AwsS3/index.js

+ 4 - 1
src/plugins/AwsS3/index.js

@@ -159,7 +159,10 @@ module.exports = class AwsS3 extends Plugin {
         // If no response, we've hopefully done a PUT request to the file
         // in the bucket on its full URL.
         if (!isXml(xhr)) {
-          return { location: xhr.responseURL }
+          // Trim the query string because it's going to be a bunch of presign
+          // parameters for a PUT request—doing a GET request with those will
+          // always result in an error
+          return { location: xhr.responseURL.replace(/\?.*$/, '') }
         }
 
         let getValue = () => ''