mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-03-17 21:12:22 +01:00
chore: move redirect logic (again)
This commit is contained in:
parent
03d09e21d7
commit
3848f263f3
@ -42,7 +42,19 @@ public abstract class BaseDownloadController : Controller
|
||||
await t.EncodeToAsync(Response.Body);
|
||||
return;
|
||||
}
|
||||
|
||||
if (voidFile.Uploader?.IsNostr ?? false)
|
||||
{
|
||||
Response.StatusCode = (int)HttpStatusCode.Redirect;
|
||||
Response.Headers.Location = $"https://files.v0l.io/{voidFile.Metadata.Digest}";
|
||||
return;
|
||||
}
|
||||
|
||||
if (voidFile.Uploader != default)
|
||||
{
|
||||
voidFile.Uploader = voidFile.Uploader!.PublicProfile ? voidFile.Uploader : null;
|
||||
}
|
||||
|
||||
var egressReq = new EgressRequest(gid, GetRanges(Request, (long)voidFile!.Metadata!.Size));
|
||||
if (egressReq.Ranges.Count() > 1)
|
||||
{
|
||||
@ -97,18 +109,6 @@ public abstract class BaseDownloadController : Controller
|
||||
return default;
|
||||
}
|
||||
|
||||
if (meta.Uploader?.IsNostr ?? false)
|
||||
{
|
||||
Response.StatusCode = (int)HttpStatusCode.Redirect;
|
||||
Response.Headers.Location = $"https://files.v0l.io/{meta.Metadata.Digest}";
|
||||
return default;
|
||||
}
|
||||
|
||||
if (meta.Uploader != default)
|
||||
{
|
||||
meta.Uploader = meta.Uploader!.PublicProfile ? meta.Uploader : null;
|
||||
}
|
||||
|
||||
return await CheckDownload(meta);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user