Skip to content

armgit / ente

Public Imported from GitHub
0

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

Fix dedup progress math, dir error message, bare electron ref

Manav Rathi632f71c2a940
diff --git a/desktop/src/main/services/dir.ts b/desktop/src/main/services/dir.ts
index 681fcc3a60..bf44a10c29 100644
--- a/desktop/src/main/services/dir.ts
+++ b/desktop/src/main/services/dir.ts
@@ -15,7 +15,7 @@ export const openDirectory = async (dirPath: string) => {
// shell.openPath requires native separators, not our POSIX IPC paths.
const res = await shell.openPath(path.normalize(dirPath));
// Electron resolves with an error message on failure.
- if (res) throw new Error(`Failed to open directory ${dirPath}: res`);
+ if (res) throw new Error(`Failed to open directory ${dirPath}: ${res}`);
};
export const openLogDirectory = () => openDirectory(logDirectoryPath());
diff --git a/web/apps/photos/src/services/dedup.ts b/web/apps/photos/src/services/dedup.ts
index 6a76d241b9..8f0a5ffb96 100644
--- a/web/apps/photos/src/services/dedup.ts
+++ b/web/apps/photos/src/services/dedup.ts
@@ -140,8 +140,9 @@ export const removeSelectedDuplicateGroups = async (
}
let np = 0;
- const ntotal = filesToAdd.size + filesToTrash.length ? 1 : 0 + /* sync */ 1;
- const tickProgress = () => onProgress((np++ / ntotal) * 100);
+ const ntotal =
+ filesToAdd.size + (filesToTrash.length ? 1 : 0) + /* sync */ 1;
+ const tickProgress = () => onProgress((++np / ntotal) * 100);
const collections = await savedNormalCollections();
const collectionsByID = new Map(collections.map((c) => [c.id, c]));
diff --git a/web/apps/photos/src/services/export.ts b/web/apps/photos/src/services/export.ts
index 30d81d317f..bb209fa7ed 100644
--- a/web/apps/photos/src/services/export.ts
+++ b/web/apps/photos/src/services/export.ts
@@ -1060,7 +1060,8 @@ class ExportService {
fileStream: ReadableStream,
file: EnteFile,
) {
- const fs = ensureElectron().fs;
+ const electron = ensureElectron();
+ const fs = electron.fs;
const fileBlob = await new Response(fileStream).blob();
const livePhoto = await decodeLivePhoto(fileFileName(file), fileBlob);
const imageExportName = await safeFileName(
@@ -1085,7 +1086,6 @@ class ExportService {
file,
);
await writeStream(
- // @ts-ignore
electron,
joinPath(collectionExportPath, imageExportName),
new Response(livePhoto.imageData).body,
@@ -1098,7 +1098,6 @@ class ExportService {
);
try {
await writeStream(
- // @ts-ignore
electron,
joinPath(collectionExportPath, videoExportName),
new Response(livePhoto.videoData).body,