From 586bf19e1a1cdb1834a16d81819421926292dfe7 Mon Sep 17 00:00:00 2001 From: Jonathan Jogenfors Date: Tue, 26 Mar 2024 23:24:00 +0100 Subject: [PATCH] refactor path validation --- server/src/services/library.service.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/src/services/library.service.ts b/server/src/services/library.service.ts index 9eb06c89d..f52f0a946 100644 --- a/server/src/services/library.service.ts +++ b/server/src/services/library.service.ts @@ -621,17 +621,14 @@ export class LibraryService extends EventEmitter { this.logger.log(`Refreshing library: ${job.id}`); - const pathValidation = await Promise.all( - library.importPaths.map((importPath) => this.validateImportPath(importPath)), - ); - const validImportPaths: string[] = []; - for (const validation of pathValidation) { + for (const importPath in library.importPaths) { + const validation = await this.validateImportPath(importPath); if (validation.isValid) { validImportPaths.push(path.normalize(validation.importPath)); } else { - this.logger.error(`Skipping invalid import path: ${validation.importPath}. Reason: ${validation.message}`); + this.logger.error(`Skipping invalid import path: ${importPath}. Reason: ${validation.message}`); } }