π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
A
Manav Rathi7b79a42cc931
diff --git a/web/packages/gallery/services/upload/takeout.ts b/web/packages/gallery/services/upload/takeout.tsindex 149f1a0c9c..08b92675ba 100644--- a/web/packages/gallery/services/upload/takeout.ts+++ b/web/packages/gallery/services/upload/takeout.ts@@ -1,7 +1,4 @@// TODO: Audit this file-/* eslint-disable @typescript-eslint/ban-ts-comment */-/* eslint-disable @typescript-eslint/no-unnecessary-condition */-/* eslint-disable @typescript-eslint/no-unsafe-assignment *//* eslint-disable @typescript-eslint/dot-notation *//** @file Dealing with the JSON metadata sidecar files */@@ -157,32 +154,33 @@ const uploadItemText = async (uploadItem: UploadItem) => {};const parseMetadataJSONText = (text: string) => {- const metadataJSON: object = JSON.parse(text);- if (!metadataJSON) {- return undefined;- }+ const metadataJSON_ = JSON.parse(text) as unknown;+ // Ignore non objects.+ if (typeof metadataJSON_ != "object") return undefined;+ // Ignore null.+ if (!metadataJSON_) return undefined;++ // At this point, `metadataJSON_` is an `object`, but TypeScript won't let+ // me index it. The following is the simplest (but unsafe) way I could think+ // of for convincing TypeScript to allow me to index `metadataJSON` with+ // `string`s.+ const metadataJSON = metadataJSON_ as Record<string, unknown>;const parsedMetadataJSON: ParsedMetadataJSON = {};parsedMetadataJSON.creationTime =- // @ts-ignoreparseGTTimestamp(metadataJSON["photoTakenTime"]) ??- // @ts-ignoreparseGTTimestamp(metadataJSON["creationTime"]);parsedMetadataJSON.modificationTime = parseGTTimestamp(- // @ts-ignoremetadataJSON["modificationTime"],);parsedMetadataJSON.location =- // @ts-ignoreparseGTLocation(metadataJSON["geoData"]) ??- // @ts-ignoreparseGTLocation(metadataJSON["geoDataExif"]);parsedMetadataJSON.description = parseGTNonEmptyString(- // @ts-ignoremetadataJSON["description"],);