Remove AllowSynchronousIOAttribute

This commit is contained in:
jvyden 2021-11-18 23:01:27 -05:00
commit 2f817f9aa8
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 0 additions and 22 deletions

View file

@ -51,7 +51,6 @@ namespace LBPUnion.ProjectLighthouse.Controllers
// TODO: check if this is a valid hash // TODO: check if this is a valid hash
[HttpPost("upload/{hash}")] [HttpPost("upload/{hash}")]
[AllowSynchronousIo]
public async Task<IActionResult> UploadResource(string hash) public async Task<IActionResult> UploadResource(string hash)
{ {
string assetsDirectory = FileHelper.ResourcePath; string assetsDirectory = FileHelper.ResourcePath;

View file

@ -1,21 +0,0 @@
using System;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.AspNetCore.Mvc.Filters;
namespace LBPUnion.ProjectLighthouse.Helpers
{
// Yoinked from https://stackoverflow.com/a/68530667
// Thanks to T-moty!
/// <summary>
/// Allows synchronous stream operations for this request.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class AllowSynchronousIoAttribute : ActionFilterAttribute
{
public override void OnResultExecuting(ResultExecutingContext context)
{
IHttpBodyControlFeature syncIoFeature = context.HttpContext.Features.Get<IHttpBodyControlFeature>();
if (syncIoFeature != null) syncIoFeature.AllowSynchronousIO = true;
}
}
}