forked from Cutlery/immich
refactor path validation
This commit is contained in:
parent
37ad05ff86
commit
586bf19e1a
@ -621,17 +621,14 @@ export class LibraryService extends EventEmitter {
|
|||||||
|
|
||||||
this.logger.log(`Refreshing library: ${job.id}`);
|
this.logger.log(`Refreshing library: ${job.id}`);
|
||||||
|
|
||||||
const pathValidation = await Promise.all(
|
|
||||||
library.importPaths.map((importPath) => this.validateImportPath(importPath)),
|
|
||||||
);
|
|
||||||
|
|
||||||
const validImportPaths: string[] = [];
|
const validImportPaths: string[] = [];
|
||||||
|
|
||||||
for (const validation of pathValidation) {
|
for (const importPath in library.importPaths) {
|
||||||
|
const validation = await this.validateImportPath(importPath);
|
||||||
if (validation.isValid) {
|
if (validation.isValid) {
|
||||||
validImportPaths.push(path.normalize(validation.importPath));
|
validImportPaths.push(path.normalize(validation.importPath));
|
||||||
} else {
|
} else {
|
||||||
this.logger.error(`Skipping invalid import path: ${validation.importPath}. Reason: ${validation.message}`);
|
this.logger.error(`Skipping invalid import path: ${importPath}. Reason: ${validation.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user