1
0
forked from Cutlery/immich

refactor path validation

This commit is contained in:
Jonathan Jogenfors 2024-03-26 23:24:00 +01:00
parent 37ad05ff86
commit 586bf19e1a

View File

@ -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}`);
}
}