mirror of
https://git.teknik.io/Teknikode/Teknik.git
synced 2023-08-02 14:16:22 +02:00
Fixed paste file closing early
This commit is contained in:
parent
7a52965300
commit
399cca937e
@ -146,10 +146,12 @@ namespace Teknik.Areas.Paste.Controllers
|
|||||||
if (string.IsNullOrEmpty(fileName))
|
if (string.IsNullOrEmpty(fileName))
|
||||||
return new StatusCodeResult(StatusCodes.Status404NotFound);
|
return new StatusCodeResult(StatusCodes.Status404NotFound);
|
||||||
var storageService = StorageServiceFactory.GetStorageService(_config.PasteConfig.StorageConfig);
|
var storageService = StorageServiceFactory.GetStorageService(_config.PasteConfig.StorageConfig);
|
||||||
using var fileStream = storageService.GetFile(fileName);
|
var fileStream = storageService.GetFile(fileName);
|
||||||
if (fileStream == null)
|
if (fileStream == null)
|
||||||
return new StatusCodeResult(StatusCodes.Status404NotFound);
|
return new StatusCodeResult(StatusCodes.Status404NotFound);
|
||||||
|
|
||||||
|
Response.RegisterForDispose(fileStream);
|
||||||
|
|
||||||
int contentSize = (int)fileStream.Length;
|
int contentSize = (int)fileStream.Length;
|
||||||
|
|
||||||
// Only load the model content if we aren't downloading it.
|
// Only load the model content if we aren't downloading it.
|
||||||
|
Loading…
Reference in New Issue
Block a user