From 25d1b3e1b1d81293e997ed6c58a38ba4779487dc Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Sun, 24 Sep 2023 15:14:25 +0200 Subject: [PATCH] fix(server): use mtime instead of ctime for fileCreatedAt (#4191) --- cli/src/cores/models/crawled-asset.ts | 2 +- server/src/domain/library/library.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/src/cores/models/crawled-asset.ts b/cli/src/cores/models/crawled-asset.ts index 41bc934427..15eb72f2b3 100644 --- a/cli/src/cores/models/crawled-asset.ts +++ b/cli/src/cores/models/crawled-asset.ts @@ -25,7 +25,7 @@ export class CrawledAsset { async process() { const stats = await fs.promises.stat(this.path); this.deviceAssetId = `${basename(this.path)}-${stats.size}`.replace(/\s+/g, ''); - this.fileCreatedAt = stats.ctime.toISOString(); + this.fileCreatedAt = stats.mtime.toISOString(); this.fileModifiedAt = stats.mtime.toISOString(); this.fileSize = stats.size; diff --git a/server/src/domain/library/library.service.ts b/server/src/domain/library/library.service.ts index 4cce996460..d4abce3e45 100644 --- a/server/src/domain/library/library.service.ts +++ b/server/src/domain/library/library.service.ts @@ -249,7 +249,7 @@ export class LibraryService { originalPath: assetPath, deviceAssetId: deviceAssetId, deviceId: 'Library Import', - fileCreatedAt: stats.ctime, + fileCreatedAt: stats.mtime, fileModifiedAt: stats.mtime, type: assetType, originalFileName: parse(assetPath).name, @@ -261,7 +261,7 @@ export class LibraryService { } else if (doRefresh && existingAssetEntity) { assetId = existingAssetEntity.id; await this.assetRepository.updateAll([existingAssetEntity.id], { - fileCreatedAt: stats.ctime, + fileCreatedAt: stats.mtime, fileModifiedAt: stats.mtime, }); } else {