root 4 months ago
parent
commit
e38806544e
1 changed files with 4 additions and 6 deletions
  1. 4 6
      js/Common/awsupload.js

+ 4 - 6
js/Common/awsupload.js

@@ -46,14 +46,12 @@ async function uploadPart(file, keyname, uploadid, pn, start, end) {
 }
 
 // 完成分块上传
-async function completeMultipartUpload(parts, keyname) {
+async function completeMultipartUpload(parts, keyname, uploadid) {
     const params = {
         Bucket: bucketname,
         Key: keyname,
         MultipartUpload: { Parts: parts },
-        UploadId: uploadid,
-        "Access-Control-Allow-Credentials": "*",
-        ACL: "public-read"
+        UploadId: uploadid
     };
     return await bucket.completeMultipartUpload(params).promise();
 }
@@ -89,7 +87,7 @@ async function uploadFile(file, folderid) {
             parts.push(await uploadPart(file, keyname, uploadid, i, start, end));
         }
         // 完成分块上传
-        await completeMultipartUpload(parts, uploadid);
+        await completeMultipartUpload(parts, keyname, uploadid);
         return uploadid;
     }
     catch (error) {
@@ -171,7 +169,7 @@ async function awsuploadpart(filestate, file, uploadid, parts, key) {
         }
     }
     //提交上传成功信息
-    var data = await completeMultipartUpload(completeparts, uploadid);
+    var data = await completeMultipartUpload(completeparts, key, uploadid);
     filestate.status = "success";
     return data;
 }