Просмотр исходного кода

set an empty string as a default for 'gcs:uploadNamespace'

Yuki Takei 1 год назад
Родитель
Сommit
c6a41630ed

+ 1 - 1
apps/app/src/server/service/config-manager/legacy/config-loader.ts

@@ -514,7 +514,7 @@ const ENV_VAR_NAME_TO_CONFIG_INFO: Record<string, EnvConfig> = {
     ns:      'crowi',
     key:     'gcs:uploadNamespace',
     type:    ValueType.STRING,
-    default: null,
+    default: '',
   },
   GCS_LIFETIME_SEC_FOR_TEMPORARY_URL: {
     ns:      'crowi',

+ 1 - 2
apps/app/src/server/service/file-uploader/gcs.ts

@@ -36,11 +36,10 @@ function getGcsInstance() {
 
 function getFilePathOnStorage(attachment) {
   const namespace = configManager.getConfig('crowi', 'gcs:uploadNamespace');
-  // const namespace = null;
   const dirName = (attachment.page != null)
     ? 'attachment'
     : 'user';
-  const filePath = urljoin(namespace || '', dirName, attachment.fileName);
+  const filePath = urljoin(namespace, dirName, attachment.fileName);
 
   return filePath;
 }