Skip to content

Commit 21cdbb4

Browse files
authored
fix: truncate file when not appending in writeFile, closes #7973 (#7982)
* Fix #7973 * Fix #7973 * Fix #7973
1 parent 1241014 commit 21cdbb4

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": 'patch:bug'
3+
---
4+
5+
Set the correct `truncate` option on `OpenOptions` so that `write_file` can completely overwrite existing files.

core/tauri/src/endpoints/file_system.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ impl Cmd {
188188
.append(append)
189189
.write(true)
190190
.create(true)
191+
.truncate(!append)
191192
.open(&resolved_path)
192193
.with_context(|| format!("path: {}", resolved_path.display()))
193194
.map_err(Into::into)

0 commit comments

Comments
 (0)