From a65e937003efed874a8037fa5022483d106963e8 Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Mon, 21 Oct 2024 10:29:32 +0100 Subject: [PATCH] fix: i18n dir scan --- api/src/i18n/services/i18n.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api/src/i18n/services/i18n.service.ts b/api/src/i18n/services/i18n.service.ts index 018e5246..52d4d063 100644 --- a/api/src/i18n/services/i18n.service.ts +++ b/api/src/i18n/services/i18n.service.ts @@ -6,7 +6,7 @@ * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ -import { promises as fs } from 'fs'; +import { existsSync, promises as fs } from 'fs'; import * as path from 'path'; import { Injectable, OnModuleInit } from '@nestjs/common'; @@ -86,11 +86,16 @@ export class I18nService> async loadExtensionI18nTranslations() { const baseDir = path.join(__dirname, '..', '..', 'extensions'); - const extensionTypes = ['channels', 'plugins']; + const extensionTypes = ['channels', 'helpers', 'plugins']; try { for (const type of extensionTypes) { const extensionsDir = path.join(baseDir, type); + + if (!existsSync(extensionsDir)) { + continue; + } + const extensionFolders = await fs.readdir(extensionsDir, { withFileTypes: true, });