mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
fix(controller): only return paste not found if null or expired
This commit is contained in:
@@ -96,7 +96,7 @@ namespace SharpbinV3.Server.Controllers
|
|||||||
public async Task<IActionResult> GetPasteByID(string id)
|
public async Task<IActionResult> GetPasteByID(string id)
|
||||||
{
|
{
|
||||||
var paste = await _pasteService.Get(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" });
|
return NotFound(new { success = false, message = "Paste not found" });
|
||||||
|
|
||||||
var jwtUser = HttpContext.GetJwtUser();
|
var jwtUser = HttpContext.GetJwtUser();
|
||||||
@@ -150,7 +150,7 @@ namespace SharpbinV3.Server.Controllers
|
|||||||
public async Task<IActionResult> GetRawPasteByID(string id)
|
public async Task<IActionResult> GetRawPasteByID(string id)
|
||||||
{
|
{
|
||||||
var paste = await _pasteService.Get(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();
|
return NotFound();
|
||||||
if (paste.IsCompressed)
|
if (paste.IsCompressed)
|
||||||
Response.Headers.Append("Content-Encoding", "gzip");
|
Response.Headers.Append("Content-Encoding", "gzip");
|
||||||
|
|||||||
Reference in New Issue
Block a user