0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-07 00:50:23 -05:00

fix(server): use mtime instead of ctime for fileCreatedAt (#4191)

This commit is contained in:
Daniele Ricci 2023-09-24 15:14:25 +02:00 committed by GitHub
parent 0e63efb490
commit 25d1b3e1b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -25,7 +25,7 @@ export class CrawledAsset {
async process() { async process() {
const stats = await fs.promises.stat(this.path); const stats = await fs.promises.stat(this.path);
this.deviceAssetId = `${basename(this.path)}-${stats.size}`.replace(/\s+/g, ''); 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.fileModifiedAt = stats.mtime.toISOString();
this.fileSize = stats.size; this.fileSize = stats.size;

View file

@ -249,7 +249,7 @@ export class LibraryService {
originalPath: assetPath, originalPath: assetPath,
deviceAssetId: deviceAssetId, deviceAssetId: deviceAssetId,
deviceId: 'Library Import', deviceId: 'Library Import',
fileCreatedAt: stats.ctime, fileCreatedAt: stats.mtime,
fileModifiedAt: stats.mtime, fileModifiedAt: stats.mtime,
type: assetType, type: assetType,
originalFileName: parse(assetPath).name, originalFileName: parse(assetPath).name,
@ -261,7 +261,7 @@ export class LibraryService {
} else if (doRefresh && existingAssetEntity) { } else if (doRefresh && existingAssetEntity) {
assetId = existingAssetEntity.id; assetId = existingAssetEntity.id;
await this.assetRepository.updateAll([existingAssetEntity.id], { await this.assetRepository.updateAll([existingAssetEntity.id], {
fileCreatedAt: stats.ctime, fileCreatedAt: stats.mtime,
fileModifiedAt: stats.mtime, fileModifiedAt: stats.mtime,
}); });
} else { } else {