From d883e70a87c6284e2cd56a7ce2eb7262129d6f22 Mon Sep 17 00:00:00 2001 From: Oliver Ford Date: Thu, 25 Apr 2024 23:46:17 +0100 Subject: [PATCH] Fix attachment download for tauri v2 --- eml-client/src-tauri/capabilities/migrated.json | 5 +++-- eml-client/src/components/EmlAttachment.svelte | 15 +-------------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/eml-client/src-tauri/capabilities/migrated.json b/eml-client/src-tauri/capabilities/migrated.json index 918b68c..0bcdc12 100644 --- a/eml-client/src-tauri/capabilities/migrated.json +++ b/eml-client/src-tauri/capabilities/migrated.json @@ -11,7 +11,8 @@ "resources:default", "menu:default", "tray:default", - "shell:allow-open", - "dialog:allow-open" + "dialog:allow-open", + "dialog:allow-save", + "fs:allow-app-write" ] } diff --git a/eml-client/src/components/EmlAttachment.svelte b/eml-client/src/components/EmlAttachment.svelte index 49e26cd..3b3f5a7 100644 --- a/eml-client/src/components/EmlAttachment.svelte +++ b/eml-client/src/components/EmlAttachment.svelte @@ -36,22 +36,9 @@ defaultPath: `${downloadDir}/${part.filename}`, }), ) - .then((selectedPath) => path - .homeDir() - .then((homeDir) => selectedPath?.replace(new RegExp(`^${homeDir}`), ""), - ), - ) .then((path) => { if (path) { - return fs.writeBinaryFile( - { - contents: part.content_encoded, - path, - }, - { - dir: 11, - }, - ) + return fs.writeFile(path, part.content_encoded) } // Else cancelled, that's ok })