mirror of
https://github.com/immich-app/immich.git
synced 2025-12-25 17:24:58 +03:00
fix: storage template failure after re-upload and previous fail (#16611)
fix: storage template breaks when files are re-uploaded after a move failure
This commit is contained in:
@@ -152,6 +152,7 @@ export class StorageTemplateService extends BaseService {
|
||||
this.logger.log('Storage template migration disabled, skipping');
|
||||
return JobStatus.SKIPPED;
|
||||
}
|
||||
await this.moveRepository.cleanMoveHistory();
|
||||
const assetPagination = usePagination(JOBS_ASSET_PAGINATION_SIZE, (pagination) =>
|
||||
this.assetRepository.getAll(pagination, { withExif: true, withArchived: true }),
|
||||
);
|
||||
@@ -175,6 +176,12 @@ export class StorageTemplateService extends BaseService {
|
||||
return JobStatus.SUCCESS;
|
||||
}
|
||||
|
||||
@OnEvent({ name: 'asset.delete' })
|
||||
async handleMoveHistoryCleanup({ assetId }: ArgOf<'asset.delete'>) {
|
||||
this.logger.debug(`Cleaning up move history for asset ${assetId}`);
|
||||
await this.moveRepository.cleanMoveHistorySingle(assetId);
|
||||
}
|
||||
|
||||
async moveAsset(asset: AssetEntity, metadata: MoveAssetMetadata) {
|
||||
if (asset.isExternal || StorageCore.isAndroidMotionPath(asset.originalPath)) {
|
||||
// External assets are not affected by storage template
|
||||
|
||||
Reference in New Issue
Block a user