π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
omitlog
Manav Rathia2a74e2166c6
diff --git a/desktop/src/main/services/ffmpeg.ts b/desktop/src/main/services/ffmpeg.tsindex 3b8e1d99f6..aab43592b3 100644--- a/desktop/src/main/services/ffmpeg.ts+++ b/desktop/src/main/services/ffmpeg.ts@@ -52,6 +52,8 @@ export const ffmpegExec = async (writeToTemporaryFile: writeToTemporaryInputFile,} = await makeFileForDataOrPathOrZipItem(dataOrPathOrZipItem);+ let success = false;+const outputFilePath = await makeTempFilePath(outputFileExtension);try {await writeToTemporaryInputFile();@@ -63,12 +65,16 @@ export const ffmpegExec = async ();await execAsync(cmd);+ // execAsync will throw on non-zero exitCode.+ success = true;return await fs.readFile(outputFilePath);} finally {if (isInputFileTemporary)await deleteTempFileIgnoringErrors(inputFilePath);- await deleteTempFileIgnoringErrors(outputFilePath);+ await deleteTempFileIgnoringErrors(outputFilePath, {+ omitLog: !success,+ });}};diff --git a/desktop/src/main/utils/temp.ts b/desktop/src/main/utils/temp.tsindex 85bfeae33e..b3a00e89ea 100644--- a/desktop/src/main/utils/temp.ts+++ b/desktop/src/main/utils/temp.ts@@ -67,12 +67,20 @@ export const deleteTempFile = async (tempFilePath: string) => {* A variant of {@link deleteTempFile} that suppresses any errors, making it* safe to call them in a sequence without needing to handle the scenario where* one of them failing causes the rest to be skipped.+ *+ * @param opts - {@link omitLog} If set, an error message will not be logged if+ * the file cannot be deleted. This is convenient when we're trying to delete a+ * file which might not even exist, and so the error is expected.*/-export const deleteTempFileIgnoringErrors = async (tempFilePath: string) => {+export const deleteTempFileIgnoringErrors = async (+ tempFilePath: string,+ opts?: { omitLog?: boolean },+) => {try {await deleteTempFile(tempFilePath);} catch (e) {- log.error(`Could not delete temporary file at path ${tempFilePath}`, e);+ if (!opts?.omitLog)+ log.error(`Failed to delete temporary file ${tempFilePath}`, e);}};