Fix: writeBinaryFile to call the correct command (fix #1133) (#1136)

* Fix writeBinaryFile to call the correct command

Fixes #1133

writeBinaryFile was reusing writeFile, which was happily saving
base64 encoded strings to the fs. This instead uses the correct
WriteBinaryFile command, which base64 decodes.

However why are we encoding and then decoding, why can we not just
send a raw byte array to be saved as a file? This is left for a later
PR.

* Shorten changelog line per review
This commit is contained in:
Zak Patterson 2021-01-06 17:30:33 +09:00 committed by GitHub
parent 5810bae022
commit 486bd920f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -0,0 +1,6 @@
---
"tauri.js": patch
"tauri": minor
---
Match writeBinaryFile command name between js and rust

View File

@ -166,7 +166,7 @@ async function writeBinaryFile(
}
return await promisified({
cmd: 'writeFile',
cmd: 'writeBinaryFile',
path: file.path,
contents: arrayBufferToBase64(file.contents),
options