Skip to content

Commit

Permalink
fix: 确保使用完以后关闭文件流。fix: #126
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Jul 6, 2023
1 parent 1822d97 commit 610e85a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion NewLife.Core/Http/StaticFilesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public virtual void ProcessRequest(IHttpContext context)
_ => null,
};

context.Response.SetResult(fi.OpenRead(), contentType);
// 确保使用完以后关闭文件流
using var fs = fi.OpenRead();
context.Response.SetResult(fs, contentType);
}
}

0 comments on commit 610e85a

Please sign in to comment.