1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-28 23:04:50 -05:00

wrap file body stream in using block

This commit is contained in:
Kyle Spearrin 2017-08-31 09:25:54 -04:00
parent 576b85f125
commit 18b60e5350

View File

@ -27,12 +27,14 @@ namespace Bit.Api.Utilities
var fileNumber = 1; var fileNumber = 1;
while(section != null && fileNumber <= fileCount) while(section != null && fileNumber <= fileCount)
{ {
ContentDispositionHeaderValue content; if(ContentDispositionHeaderValue.TryParse(section.ContentDisposition, out var content) &&
if(ContentDispositionHeaderValue.TryParse(section.ContentDisposition, out content) &&
HasFileContentDisposition(content)) HasFileContentDisposition(content))
{ {
var fileName = HeaderUtilities.RemoveQuotes(content.FileName) ?? string.Empty; var fileName = HeaderUtilities.RemoveQuotes(content.FileName) ?? string.Empty;
await callback(section.Body, fileName); using(section.Body)
{
await callback(section.Body, fileName);
}
} }
if(fileNumber >= fileCount) if(fileNumber >= fileCount)