itizawa пре 5 година
родитељ
комит
75cf9abb9d
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      src/server/service/file-uploader/gcs.js

+ 5 - 2
src/server/service/file-uploader/gcs.js

@@ -56,8 +56,11 @@ module.exports = function(crowi) {
   };
   };
 
 
   lib.respond = async function(res, attachment) {
   lib.respond = async function(res, attachment) {
-    // TODO refacotr this code after GW-4630
-    const gcs = getGcsInstance(this.getIsUploadable());
+    if (!this.getIsUploadable()) {
+      throw new Error('GCS is not configured.');
+    }
+
+    const gcs = getGcsInstance();
     const myBucket = gcs.bucket(getGcsBucket());
     const myBucket = gcs.bucket(getGcsBucket());
     const filePath = getFilePathOnStorage(attachment);
     const filePath = getFilePathOnStorage(attachment);
     const file = myBucket.file(filePath);
     const file = myBucket.file(filePath);