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

Make getConfig call synchronous

arvid-e 9 месяцев назад
Родитель
Сommit
9166ac161a
1 измененных файлов с 3 добавлено и 5 удалено
  1. 3 5
      apps/app/src/server/routes/apiv3/content-disposition-settings.ts

+ 3 - 5
apps/app/src/server/routes/apiv3/content-disposition-settings.ts

@@ -72,11 +72,11 @@ module.exports = (crowi) => {
  *
  *
  */
  */
   router.get('/', loginRequiredStrictly, adminRequired, async(req, res) => {
   router.get('/', loginRequiredStrictly, adminRequired, async(req, res) => {
-    const promises = CONFIGURABLE_MIME_TYPES_FOR_DISPOSITION.map(
-      async(mimeType) => {
+    const results = CONFIGURABLE_MIME_TYPES_FOR_DISPOSITION.map(
+      (mimeType) => {
         const configKey = `attachments:contentDisposition:${mimeType}:inline`;
         const configKey = `attachments:contentDisposition:${mimeType}:inline`;
         try {
         try {
-          const value = await crowi.configManager.getConfig(configKey);
+          const value = crowi.configManager.getConfig(configKey);
           return { mimeType, value };
           return { mimeType, value };
         }
         }
         catch (err) {
         catch (err) {
@@ -88,8 +88,6 @@ module.exports = (crowi) => {
       },
       },
     );
     );
 
 
-    const results = await Promise.all(promises);
-
     const contentDispositionSettings = {};
     const contentDispositionSettings = {};
     for (const result of results) {
     for (const result of results) {
       contentDispositionSettings[result.mimeType] = result.value;
       contentDispositionSettings[result.mimeType] = result.value;