π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
spl
Manav Rathiaa70b2a437ee
diff --git a/web/apps/photos/src/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsxindex 6eacfd8266..ffa379411c 100644--- a/web/apps/photos/src/components/Upload.tsx+++ b/web/apps/photos/src/components/Upload.tsx@@ -30,6 +30,7 @@ import type { CollectionMapping, Electron, ZipItem } from "ente-base/types/ipc";import { useFileInput } from "ente-gallery/components/utils/use-file-input";import {groupItemsBasedOnParentFolder,+ uploadPathPrefix,type FileAndPath,type UploadItem,type UploadItemAndPath,@@ -562,7 +563,7 @@ export const Upload: React.FC<UploadProps> = ({const uploadItemsWithCollection = uploadItemsAndPaths.current.map(([uploadItem, path], index) => ({uploadItem,- uploadItemPathPrefix: dirname(path),+ uploadItemPathPrefix: uploadPathPrefix(path),localID: index,collectionID: collection.id,}),@@ -614,7 +615,7 @@ export const Upload: React.FC<UploadProps> = ({...uploadItemsWithCollection,...uploadItems.map(([uploadItem, path]) => ({localID: index++,- uploadItemPathPrefix: dirname(path),+ uploadItemPathPrefix: uploadPathPrefix(path),collectionID: collection.id,uploadItem,})),diff --git a/web/packages/gallery/services/upload/index.ts b/web/packages/gallery/services/upload/index.tsindex 8d340d31be..1df06e4258 100644--- a/web/packages/gallery/services/upload/index.ts+++ b/web/packages/gallery/services/upload/index.ts@@ -163,9 +163,25 @@ export interface TimestampedFileSystemUploadItem {** And can thus be used to associate the correct metadata JSON with the* corresponding {@link UploadItem}.+ *+ * As a special case, "/metadata" at the end of the path prefix is discarded.+ * This allows the metadata JSON written by export to be read back in during+ * uploads. See: [Note: Fold "metadata" directory into parent folder].*/export type UploadPathPrefix = string;+/**+ * Return the {@link UploadPathPrefix} for the given {@link pathOrName} of an+ * item being uploaded.+ */+export const uploadPathPrefix = (pathOrName: string) => {+ const folderPath = dirname(pathOrName);+ if (basename(folderPath) == exportMetadataDirectoryName) {+ return dirname(folderPath);+ }+ return folderPath;+};+export type UploadItemAndPath = [UploadItem, string];/**diff --git a/web/packages/gallery/services/upload/upload-service.ts b/web/packages/gallery/services/upload/upload-service.tsindex b05854f530..1241bb5247 100644--- a/web/packages/gallery/services/upload/upload-service.ts+++ b/web/packages/gallery/services/upload/upload-service.ts@@ -254,14 +254,26 @@ export type ExternalParsedMetadata = ParsedMetadata & {};export interface UploadAsset {- /** `true` if this is a live photo. */+ /**+ * `true` if this is a live photo.+ */isLivePhoto?: boolean;- /* Valid for live photos */+ /**+ * The two parts of the live photo being uploaded.+ *+ * Valid for live photos.+ */livePhotoAssets?: LivePhotoAssets;- /* Valid for non-live photos */+ /**+ * The item being uploaded.+ *+ * Valid for non-live photos.+ */uploadItem?: UploadItem;/*** The path prefix of the uploadItem, if available.+ *+ * Valid for non-live photos.*/uploadItemPathPrefix?: UploadPathPrefix;/**