Skip to content

Commit

Permalink
fix(services/fs): Make sure writing file is truncated (#1036)
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <[email protected]>

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Dec 2, 2022
1 parent 3ba84c2 commit 524ec82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/services/fs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ impl Accessor for Backend {

fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(&p)
.await
Expand Down Expand Up @@ -336,6 +337,7 @@ impl Accessor for Backend {
let target_path = Self::ensure_write_abs_path(&self.root, path).await?;
let f = fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(&temp_path)
.await
Expand All @@ -356,6 +358,7 @@ impl Accessor for Backend {

let f = fs::OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(&p)
.await
Expand Down

1 comment on commit 524ec82

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for opendal ready!

✅ Preview
https://opendal-9e5uc6jai-databend.vercel.app

Built with commit 524ec82.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.