Manav Rathi vor 1 Jahr
Ursprung
Commit
c90ba63aad

+ 5 - 1
web/apps/photos/src/services/export/index.ts

@@ -32,7 +32,6 @@ import {
     getDeletedExportedCollections,
     getDeletedExportedFiles,
     getExportRecordFileUID,
-    getFileExportPath,
     getFileMetadataExportPath,
     getGoogleLikeMetadataFile,
     getLivePhotoExportName,
@@ -1202,3 +1201,8 @@ class ExportService {
 }
 
 export default new ExportService();
+
+export const getFileExportPath = (
+    collectionExportPath: string,
+    fileExportName: string,
+) => `${collectionExportPath}/${fileExportName}`;

+ 1 - 8
web/apps/photos/src/utils/export/index.ts

@@ -219,9 +219,7 @@ export const getUniqueFileExportName = async (
     let fileExportName = sanitizeName(filename);
     let count = 1;
     while (
-        await exportService.exists(
-            getFileExportPath(collectionExportPath, fileExportName),
-        )
+        await exportService.exists(`${collectionExportPath}/${fileExportName}`)
     ) {
         const filenameParts = splitFilenameAndExtension(sanitizeName(filename));
         if (filenameParts[1]) {
@@ -239,11 +237,6 @@ export const getFileMetadataExportPath = (
     fileExportName: string,
 ) => `${collectionExportPath}/${ENTE_METADATA_FOLDER}/${fileExportName}.json`;
 
-export const getFileExportPath = (
-    collectionExportPath: string,
-    fileExportName: string,
-) => `${collectionExportPath}/${fileExportName}`;
-
 export const getTrashedFileExportPath = async (
     exportDir: string,
     path: string,

+ 5 - 7
web/apps/photos/src/utils/file/index.ts

@@ -51,7 +51,7 @@ import {
 } from "types/gallery";
 import { VISIBILITY_STATE } from "types/magicMetadata";
 import { FileTypeInfo } from "types/upload";
-import { getFileExportPath, getUniqueFileExportName } from "utils/export";
+import { getUniqueFileExportName } from "utils/export";
 import { isArchivedFile, updateMagicMetadata } from "utils/magicMetadata";
 
 const WAIT_TIME_IMAGE_CONVERSION = 30 * 1000;
@@ -818,7 +818,7 @@ async function downloadFileDesktop(
         );
         const imageStream = generateStreamFromArrayBuffer(livePhoto.image);
         await electron.saveStreamToDisk(
-            getFileExportPath(downloadPath, imageExportName),
+            `${downloadPath}/${imageExportName}`,
             imageStream,
         );
         try {
@@ -828,13 +828,11 @@ async function downloadFileDesktop(
             );
             const videoStream = generateStreamFromArrayBuffer(livePhoto.video);
             await electron.saveStreamToDisk(
-                getFileExportPath(downloadPath, videoExportName),
+                `${downloadPath}/${videoExportName}`,
                 videoStream,
             );
         } catch (e) {
-            await electron.deleteFile(
-                getFileExportPath(downloadPath, imageExportName),
-            );
+            await electron.deleteFile(`${downloadPath}/${imageExportName}`);
             throw e;
         }
     } else {
@@ -843,7 +841,7 @@ async function downloadFileDesktop(
             file.metadata.title,
         );
         await electron.saveStreamToDisk(
-            getFileExportPath(downloadPath, fileExportName),
+            `${downloadPath}/${fileExportName}`,
             updatedFileStream,
         );
     }