itizawa 5 лет назад
Родитель
Сommit
3beb7c5c0a
2 измененных файлов с 7 добавлено и 3 удалено
  1. 3 3
      src/server/service/file-uploader/gcs.js
  2. 4 0
      src/server/service/file-uploader/uploader.js

+ 3 - 3
src/server/service/file-uploader/gcs.js

@@ -15,8 +15,8 @@ module.exports = function(crowi) {
     return configManager.getConfig('crowi', 'gcs:bucket');
     return configManager.getConfig('crowi', 'gcs:bucket');
   }
   }
 
 
-  function getGcsInstance(isUploadable) {
-    if (!isUploadable) {
+  function getGcsInstance(isConnectable) {
+    if (!isConnectable) {
       throw new Error('GCS is not configured.');
       throw new Error('GCS is not configured.');
     }
     }
     if (_instance == null) {
     if (_instance == null) {
@@ -93,7 +93,7 @@ module.exports = function(crowi) {
    * @return {stream.Readable} readable stream
    * @return {stream.Readable} readable stream
    */
    */
   lib.findDeliveryFile = async function(attachment) {
   lib.findDeliveryFile = async function(attachment) {
-    const gcs = getGcsInstance(this.getIsUploadable());
+    const gcs = getGcsInstance(this.getIsReadable());
     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);

+ 4 - 0
src/server/service/file-uploader/uploader.js

@@ -12,6 +12,10 @@ class Uploader {
     return !this.configManager.getConfig('crowi', 'app:fileUploadDisabled') && this.isValidUploadSettings();
     return !this.configManager.getConfig('crowi', 'app:fileUploadDisabled') && this.isValidUploadSettings();
   }
   }
 
 
+  getIsReadable() {
+    return this.isValidUploadSettings();
+  }
+
   isValidUploadSettings() {
   isValidUploadSettings() {
     throw new Error('Implement this');
     throw new Error('Implement this');
   }
   }