diff --git a/BTCPayServer.Client/BTCPayServerClient.cs b/BTCPayServer.Client/BTCPayServerClient.cs index 1e3a03535..85adbddf8 100644 --- a/BTCPayServer.Client/BTCPayServerClient.cs +++ b/BTCPayServer.Client/BTCPayServerClient.cs @@ -156,7 +156,7 @@ public partial class BTCPayServerClient protected virtual async Task UploadFileRequest(string apiPath, string filePath, string mimeType, string formFieldName, HttpMethod method = null, CancellationToken token = default) { using MultipartFormDataContent multipartContent = new(); - var fileContent = new StreamContent(File.OpenRead(filePath)); + using var fileContent = new StreamContent(File.OpenRead(filePath)); var fileName = Path.GetFileName(filePath); fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse(mimeType); multipartContent.Add(fileContent, formFieldName, fileName);