zamis 5 years ago
parent
commit
3823a02c3c
1 changed files with 4 additions and 12 deletions
  1. 4 12
      src/server/service/file-uploader/aws.js

+ 4 - 12
src/server/service/file-uploader/aws.js

@@ -123,23 +123,15 @@ module.exports = function(crowi) {
     const s3 = S3Factory();
     const s3 = S3Factory();
     const awsConfig = getAwsConfig();
     const awsConfig = getAwsConfig();
 
 
-    const filePaths = [];
-    attachments.forEach(attachment => filePaths.push(getFilePathOnStorage(attachment)));
+    const filePaths = attachments.map((attachment) => {
+      return { Key: getFilePathOnStorage(attachment) };
+    });
 
 
     const totalParams = {
     const totalParams = {
       Bucket: awsConfig.bucket,
       Bucket: awsConfig.bucket,
-      Delete: { Objects: [] },
+      Delete: { Objects: filePaths },
     };
     };
 
 
-    const Objects = [];
-    filePaths.forEach((filePath) => {
-      Objects.push({ Key: filePath });
-    });
-
-    Objects.forEach((object) => {
-      totalParams.Delete.Objects.push(object);
-    });
-
     return s3.deleteObjects(totalParams).promise();
     return s3.deleteObjects(totalParams).promise();
   };
   };