Fix: writeBinaryFile to call the correct command (fix #1133)#1136
Merged
nothingismagick merged 2 commits intotauri-apps:devfrom Jan 6, 2021
Merged
Conversation
nothingismagick
requested changes
Jan 6, 2021
Member
nothingismagick
left a comment
There was a problem hiding this comment.
Just please shorten the changefile and then will merge and kickoff a release. Thanks for tracking this down!
nothingismagick
approved these changes
Jan 6, 2021
Member
|
I have reviewed this code and accept that the commits weren't signed. In the future, @zakpatterson, please consider signing commits with gpg. |
Contributor
Author
Also happy to set that up and force push new commits if you want to give me a few minutes. |
Member
|
Sure, will wait for you to force-push. Thanks @zakpatterson ❤️ |
Fixes tauri-apps#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.
a2b140f to
13a15fe
Compare
Contributor
Author
Better? |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
The PR fulfills these requirements:
fix: #xxx[,#xxx], where "xxx" is the issue number)If adding a new feature, the PR's description includes:
Other information:
Fixes #1133.
Fix writeBinaryFile in the js api to call the correct function on the rust side. Before, files were sent in base64 encoding, but the save-as-text
WriteFilefs command was reused, without any indication that the contents were base64 encoded. So the WriteFile command had no way of checking and decoding when necessary. WriteBinaryFile on the rust side expects a base64 encoded string, then decodes it.