Skip to content

Commit

Permalink
Dispose of FileStream after TUS upload
Browse files Browse the repository at this point in the history
The library doesn't do this for us. This would be unsafe if we weren't
awaiting the result of TusPatchAsync, but by the time TusPatchAsync
returns, the FileStream is no longer needed.
  • Loading branch information
rmunn committed Aug 26, 2024
1 parent 6844012 commit 0f10f6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/LfMerge.Core.Tests/SRTestEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public async Task TusUpload(Uri tusEndpoint, string path, string mimeType)
var createResponse = await Http.TusCreateAsync(createOpts);

// That doesn't actually upload the file; TusPatchAsync does the actual upload
var fileStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read);
using var fileStream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read);
var patchOpts = new TusPatchRequestOption {
FileLocation = createResponse.FileLocation,
Stream = fileStream,
Expand Down

0 comments on commit 0f10f6b

Please sign in to comment.