Skip to content

High performance self-hosted photo and video management solution.

fix(server): offline assets don't restore when coming back online (#13087)

Zack Pollardd46e50213a0d
diff --git a/server/src/services/library.service.ts b/server/src/services/library.service.ts
index 4b296570eb..07313e4ec8 100644
--- a/server/src/services/library.service.ts
+++ b/server/src/services/library.service.ts
@@ -141,7 +141,13 @@ export class LibraryService extends BaseService {
const handler = async () => {
this.logger.debug(`File add event received for ${path} in library ${library.id}}`);
if (matcher(path)) {
- await this.syncFiles(library, [path]);
+ const asset = await this.assetRepository.getByLibraryIdAndOriginalPath(library.id, path);
+ if (asset) {
+ await this.syncAssets(library, [asset.id]);
+ }
+ if (matcher(path)) {
+ await this.syncFiles(library, [path]);
+ }
}
};
return handlePromiseError(handler(), this.logger);
@@ -604,7 +610,7 @@ export class LibraryService extends BaseService {
this.logger.log(`Scanning library ${library.id} for removed assets`);
const onlineAssets = usePagination(JOBS_LIBRARY_PAGINATION_SIZE, (pagination) =>
- this.assetRepository.getAll(pagination, { libraryId: job.id }),
+ this.assetRepository.getAll(pagination, { libraryId: job.id, withDeleted: true }),
);
let assetCount = 0;