1
0
forked from Cutlery/immich

fix comments

This commit is contained in:
Jonathan Jogenfors 2024-03-25 23:36:59 +01:00
parent 57450108be
commit 52a19b6f1f

View File

@ -574,7 +574,7 @@ export class LibraryService extends EventEmitter {
return JobStatus.SUCCESS; return JobStatus.SUCCESS;
} }
// Check if an asset is has no file or is outside of import paths, marking it as offline // Check if an asset has no file or is outside of import paths, marking it as offline
async handleOfflineCheck(job: ILibraryOfflineJob): Promise<JobStatus> { async handleOfflineCheck(job: ILibraryOfflineJob): Promise<JobStatus> {
const asset = await this.assetRepository.getById(job.id); const asset = await this.assetRepository.getById(job.id);
@ -585,16 +585,9 @@ export class LibraryService extends EventEmitter {
const exists = await this.storageRepository.checkFileExists(asset.originalPath, R_OK); const exists = await this.storageRepository.checkFileExists(asset.originalPath, R_OK);
let existsInImportPath = false; const isInPath = job.importPaths.find((path) => asset.originalPath.startsWith(path));
for (const importPath of job.importPaths) { if (exists && isInPath) {
if (asset.originalPath.startsWith(importPath)) {
existsInImportPath = true;
break;
}
}
if (exists && existsInImportPath) {
this.logger.verbose(`Asset is still online: ${asset.originalPath}`); this.logger.verbose(`Asset is still online: ${asset.originalPath}`);
} else { } else {
this.logger.debug(`Marking asset as offline: ${asset.originalPath}`); this.logger.debug(`Marking asset as offline: ${asset.originalPath}`);
@ -629,7 +622,7 @@ export class LibraryService extends EventEmitter {
this.logger.log(`Refreshing library: ${job.id}`); this.logger.log(`Refreshing library: ${job.id}`);
const pathValidation = await Promise.all( const pathValidation = await Promise.all(
library.importPaths.map(async (importPath) => await this.validateImportPath(importPath)), library.importPaths.map((importPath) => this.validateImportPath(importPath)),
); );
const validImportPaths = pathValidation const validImportPaths = pathValidation