From ec22181ba6d25d403b5d555799086c4085c96f58 Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 20 Jul 2021 15:05:44 +0800 Subject: [PATCH] dispose of the remoteStream object. --- .../RemoteStreamContentOutputFormatter.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs index 26dd0b0999..50d65ce02d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs @@ -1,5 +1,4 @@ using System; -using System.Buffers; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Net.Http.Headers; @@ -34,9 +33,9 @@ namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters context.HttpContext.Response.Headers[HeaderNames.ContentDisposition] = contentDisposition.ToString(); } - using (var stream = remoteStream.GetStream()) - { - await stream.CopyToAsync(context.HttpContext.Response.Body); + using (remoteStream) + { + await remoteStream.GetStream().CopyToAsync(context.HttpContext.Response.Body); } } }