Skip to content

armgit / ente

Public Imported from GitHub
0

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

Retain original image URL

Manav Rathi13752654cd36
diff --git a/web/packages/gallery/components/viewer/data-source.ts b/web/packages/gallery/components/viewer/data-source.ts
index 2a3cb6aba2..1c27344a0e 100644
--- a/web/packages/gallery/components/viewer/data-source.ts
+++ b/web/packages/gallery/components/viewer/data-source.ts
@@ -1,16 +1,13 @@
-/* xeslint-disable */
-// x-@ts-nocheck
-
import log from "@/base/log";
import {
downloadManager,
type LivePhotoSourceURL,
} from "@/gallery/services/download";
import type { EnteFile } from "@/media/file";
+import type { ParsedMetadata } from "@/media/file-metadata";
import { FileType } from "@/media/file-type";
import { ensureString } from "@/utils/ensure";
// TODO(PS):
-import type { ParsedMetadata } from "@/media/file-metadata";
import {
extractRawExif,
parseExif,
@@ -26,11 +23,15 @@ interface PhotoSwipeSlideData {
* The image URL expected by PhotoSwipe.
*
* This is set to the URL of the image that should be shown in the image
- * viewer component provided by PhotoSwipe. It will be a renderable (i.e.,
- * possibly converted) object URL obtained from the current "best" image we
- * have: e.g. if all we have is the thumbnail, then this'll be an renderable
- * object URL from the thumbnail. Then later when we fetch the original
- * image, this'll be the renderable object URL derived from the original.
+ * viewer component provided by PhotoSwipe.
+ *
+ * It will be a renderable (i.e., possibly converted) object URL obtained
+ * from the current "best" image we have.
+ *
+ * For example, if all we have is the thumbnail, then this'll be an
+ * renderable object URL obtained from the thumbnail data. Then later when
+ * we fetch the original image, this'll be the renderable object URL derived
+ * from the original. But if it is a video, this will just be cleared.
*/
src?: string | undefined;
/**
diff --git a/web/packages/gallery/services/download.ts b/web/packages/gallery/services/download.ts
index 03fa6c2f14..d7eb4dadb7 100644
--- a/web/packages/gallery/services/download.ts
+++ b/web/packages/gallery/services/download.ts
@@ -52,6 +52,7 @@ export interface LoadedLivePhotoSourceURL {
*/
export interface RenderableSourceURLs {
url: string | LivePhotoSourceURL | LoadedLivePhotoSourceURL;
+ originalImageURL: string | undefined;
type: "normal" | "livePhoto";
/**
* `true` if there is potential conversion that can still be applied.
@@ -545,6 +546,7 @@ const createRenderableSourceURLs = async (
: undefined;
let url: RenderableSourceURLs["url"] | undefined;
+ let originalImageURL: RenderableSourceURLs["originalImageURL"] | undefined;
let type: RenderableSourceURLs["type"] = "normal";
let mimeType: string | undefined;
let canForceConvert = false;
@@ -555,6 +557,7 @@ const createRenderableSourceURLs = async (
const convertedBlob = await renderableImageBlob(fileBlob, fileName);
const convertedURL = existingOrNewObjectURL(convertedBlob);
url = convertedURL;
+ originalImageURL = originalFileURL;
mimeType = convertedBlob.type;
break;
}
@@ -591,6 +594,7 @@ const createRenderableSourceURLs = async (
// @ts-ignore
return {
url: url!,
+ originalImageURL,
type,
mimeType,
canForceConvert,