fix(controller): only return paste not found if null or expired

This commit is contained in:
2026-03-10 19:06:50 -04:00
parent 8b8c0bbf7a
commit f70328c93d
@@ -96,7 +96,7 @@ namespace SharpbinV3.Server.Controllers
public async Task<IActionResult> GetPasteByID(string id)
{
var paste = await _pasteService.Get(id);
if (paste == null || (paste.ExpiresAt < DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() && paste.Visibility != 0))
if (paste == null || paste.ExpiresAt < DateTimeOffset.UtcNow.ToUnixTimeMilliseconds())
return NotFound(new { success = false, message = "Paste not found" });
var jwtUser = HttpContext.GetJwtUser();
@@ -150,7 +150,7 @@ namespace SharpbinV3.Server.Controllers
public async Task<IActionResult> GetRawPasteByID(string id)
{
var paste = await _pasteService.Get(id);
if (paste == null || (paste.ExpiresAt < DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() && paste.Visibility != 0))
if (paste == null || paste.ExpiresAt < DateTimeOffset.UtcNow.ToUnixTimeMilliseconds())
return NotFound();
if (paste.IsCompressed)
Response.Headers.Append("Content-Encoding", "gzip");