fix: nostr redirect user load

This commit is contained in:
Kieran 2024-09-26 17:15:10 +01:00
parent f7c799f694
commit 03d09e21d7
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
2 changed files with 8 additions and 3 deletions

View File

@ -90,13 +90,13 @@ public abstract class BaseDownloadController : Controller
protected async Task<VoidFileResponse?> SetupDownload(Guid id)
{
var meta = await _fileInfo.Get(id, false);
var meta = await _fileInfo.Get(id, true);
if (meta == null)
{
Response.StatusCode = 404;
return default;
}
if (meta.Uploader?.IsNostr ?? false)
{
Response.StatusCode = (int)HttpStatusCode.Redirect;
@ -104,6 +104,11 @@ public abstract class BaseDownloadController : Controller
return default;
}
if (meta.Uploader != default)
{
meta.Uploader = meta.Uploader!.PublicProfile ? meta.Uploader : null;
}
return await CheckDownload(meta);
}

View File

@ -12,7 +12,7 @@ public class VoidFileResponse
public Guid Id { get; init; }
public VoidFileMeta Metadata { get; init; } = null!;
public Paywall? Payment { get; init; }
public ApiUser? Uploader { get; init; }
public ApiUser? Uploader { get; set; }
public Bandwidth? Bandwidth { get; init; }
public VirusStatus? VirusScan { get; init; }
}