Redirect from file store for direct serve

This commit is contained in:
Kieran
2022-07-25 19:46:14 +01:00
parent 99907fce8b
commit 3b1bf9f12d
8 changed files with 49 additions and 16 deletions

View File

@@ -75,6 +75,15 @@ public class DownloadController : Controller
Response.ContentLength = range.Size;
}
var preResult = await _storage.StartEgress(egressReq);
if (preResult.Redirect != null)
{
Response.StatusCode = (int)HttpStatusCode.Redirect;
Response.Headers.Location = preResult.Redirect.ToString();
Response.ContentLength = 0;
return;
}
var cts = HttpContext.RequestAborted;
await Response.StartAsync(cts);
await _storage.Egress(egressReq, Response.Body, cts);