Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

grandfather

Manav Rathid59d3c3b07e4
diff --git a/web/packages/media/file.ts b/web/packages/media/file.ts
index f087dbb17e..9499aa4523 100644
--- a/web/packages/media/file.ts
+++ b/web/packages/media/file.ts
@@ -2,6 +2,7 @@ import { sharedCryptoWorker } from "@/base/crypto";
import { dateFromEpochMicroseconds } from "@/base/date";
import log from "@/base/log";
import { type Metadata, ItemVisibility } from "./file-metadata";
+import { FileType } from "./file-type";
// TODO: Audit this file.
@@ -405,12 +406,19 @@ export const mergeMetadata1 = (file: EnteFile): EnteFile => {
}
}
- // In a very rare cases (have found only one so far, a very old file in
+ // In very rare cases (have found only one so far, a very old file in
// Vishnu's account, uploaded by an initial dev version of Ente) the photo
// has no modification time. Gracefully handle such cases.
if (!file.metadata.modificationTime)
file.metadata.modificationTime = file.metadata.creationTime;
+ // In very rare cases (again, some files shared with Vishnu's account,
+ // uploaded by dev builds) the photo might not have a file type. Gracefully
+ // handle these too. The file ID threshold is an arbitrary cutoff so that
+ // this graceful handling does not mask new issues.
+ if (!file.metadata.fileType && file.id < 100000000)
+ file.metadata.fileType = FileType.image;
+
return file;
};