1
0
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:
Uncled1023 2022-05-29 14:52:13 -07:00
parent 7a52965300
commit 399cca937e

View File

@ -146,10 +146,12 @@ namespace Teknik.Areas.Paste.Controllers
if (string.IsNullOrEmpty(fileName))
return new StatusCodeResult(StatusCodes.Status404NotFound);
var storageService = StorageServiceFactory.GetStorageService(_config.PasteConfig.StorageConfig);
using var fileStream = storageService.GetFile(fileName);
var fileStream = storageService.GetFile(fileName);
if (fileStream == null)
return new StatusCodeResult(StatusCodes.Status404NotFound);
Response.RegisterForDispose(fileStream);
int contentSize = (int)fileStream.Length;
// Only load the model content if we aren't downloading it.