Manav Rathi 1 سال پیش
والد
کامیت
3a2cc86136
1فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 9 0
      web/apps/photos/src/services/download/index.ts

+ 9 - 0
web/apps/photos/src/services/download/index.ts

@@ -31,6 +31,12 @@ export type SourceURLs = {
     isOriginal: boolean;
     isOriginal: boolean;
     isRenderable: boolean;
     isRenderable: boolean;
     type: "normal" | "livePhoto";
     type: "normal" | "livePhoto";
+    /**
+     * Best effort attempt at obtaining the MIME type. This should always be set
+     * ideally, over time we need to find and fix the types for the cases where
+     * it can be missing.
+     */
+    mimeType?: string;
 };
 };
 
 
 export type OnDownloadProgress = (event: {
 export type OnDownloadProgress = (event: {
@@ -476,6 +482,7 @@ async function getRenderableFileURL(
     forceConvert: boolean,
     forceConvert: boolean,
 ): Promise<SourceURLs> {
 ): Promise<SourceURLs> {
     let srcURLs: SourceURLs["url"];
     let srcURLs: SourceURLs["url"];
+    let mimeType: string | undefined;
     switch (file.metadata.fileType) {
     switch (file.metadata.fileType) {
         case FILE_TYPE.IMAGE: {
         case FILE_TYPE.IMAGE: {
             const convertedBlob = await getRenderableImage(
             const convertedBlob = await getRenderableImage(
@@ -488,6 +495,7 @@ async function getRenderableFileURL(
                 convertedBlob,
                 convertedBlob,
             );
             );
             srcURLs = convertedURL;
             srcURLs = convertedURL;
+            mimeType = convertedBlob.type;
             break;
             break;
         }
         }
         case FILE_TYPE.LIVE_PHOTO: {
         case FILE_TYPE.LIVE_PHOTO: {
@@ -534,6 +542,7 @@ async function getRenderableFileURL(
             file.metadata.fileType === FILE_TYPE.LIVE_PHOTO
             file.metadata.fileType === FILE_TYPE.LIVE_PHOTO
                 ? "livePhoto"
                 ? "livePhoto"
                 : "normal",
                 : "normal",
+        mimeType,
     };
     };
 }
 }