2
0
Эх сурвалжийг харах

WIP
refs GW-232: GCS にアップロードできる
- 削除機能

Otani Haruhiko 6 жил өмнө
parent
commit
aed575d14a

+ 3 - 8
src/server/service/file-uploader/gcp.js

@@ -41,17 +41,12 @@ module.exports = function(crowi) {
   };
   };
 
 
   lib.deleteFileByFilePath = async function(filePath) {
   lib.deleteFileByFilePath = async function(filePath) {
-    const s3 = GCSFactory(this.getIsUploadable());
-    const awsConfig = getGcsConfig();
-
-    const params = {
-      Bucket: awsConfig.bucket,
-      Key: filePath,
-    };
+    const gcs = GCSFactory(this.getIsUploadable());
+    const myBucket = gcs.bucket(getGcsBucket());
 
 
     // TODO: ensure not to throw error even when the file does not exist
     // TODO: ensure not to throw error even when the file does not exist
 
 
-    return s3.deleteObject(params).promise();
+    return myBucket.file(filePath).delete();
   };
   };
 
 
   lib.uploadFile = function(fileStream, attachment) {
   lib.uploadFile = function(fileStream, attachment) {