Sfoglia il codice sorgente

WIP
refs GW-232: GCS にアップロードできる
- アップロード処理追加

Otani Haruhiko 6 anni fa
parent
commit
1024cc7e7c
1 ha cambiato i file con 3 aggiunte e 12 eliminazioni
  1. 3 12
      src/server/service/file-uploader/gcp.js

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

@@ -57,19 +57,10 @@ module.exports = function(crowi) {
   lib.uploadFile = function(fileStream, attachment) {
     logger.debug(`File uploading: fileName=${attachment.fileName}`);
 
-    const s3 = GCSFactory(this.getIsUploadable());
-    const awsConfig = getGcsConfig();
-
-    const filePath = getFilePathOnStorage(attachment);
-    const params = {
-      Bucket: awsConfig.bucket,
-      ContentType: attachment.fileFormat,
-      Key: filePath,
-      Body: fileStream,
-      ACL: 'public-read',
-    };
+    const gcs = GCSFactory(this.getIsUploadable());
+    const myBucket = gcs.bucket(getGcsBucket());
 
-    return s3.upload(params).promise();
+    return myBucket.upload(fileStream.path);
   };
 
   /**