Skip to content

Commit

Permalink
Use FileMode.Create to ensure we do't leave parts of an existing file…
Browse files Browse the repository at this point in the history
… in case of overwrite
  • Loading branch information
Oren Novotny committed Sep 25, 2019
1 parent 407ff8a commit af7cfdc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SignClient/SignCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ CommandOption descriptionUrl

var str = await response.Content.ReadAsStreamAsync();

using var fs = output.OpenWrite();
// If we're replacing the file, make sure to the existing one first
using var fs = new FileStream(output.FullName, FileMode.Create);
await str.CopyToAsync(fs).ConfigureAwait(false);
}
catch (AuthenticationException e)
Expand Down

0 comments on commit af7cfdc

Please sign in to comment.