Skip to content

Commit

Permalink
http: #25 rather not overwrite, too unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
skomski committed Jul 12, 2020
1 parent 47c9987 commit 2144143
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/http_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,10 @@ pub async fn run(

trace!("file_path {}", sound_path.display());

if let Err(err) = std::fs::write(&sound_path, upload_data) {
return format_json_error(err);
if !sound_path.exists() {
if let Err(err) = std::fs::write(&sound_path, upload_data) {
return format_json_error(err);
}
}

let sound_config = config::SoundConfig {
Expand Down

0 comments on commit 2144143

Please sign in to comment.