Skip to content

Commit

Permalink
Add secondary check for lastReviewTime validity (#1388)
Browse files Browse the repository at this point in the history
  • Loading branch information
karashiiro authored Nov 25, 2024
1 parent f7b2aec commit c8d3db5
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ public async Task<IActionResult> Execute(ApiKey source, UploadParameters paramet
private static bool IsInvalid(Universalis.Application.Uploads.Schema.Listing l)
{
// Listings can be up for at most 7 days - checking against 8 to give some buffer
var lastReviewTime = DateTimeOffset.FromUnixTimeSeconds(l.LastReviewTimeUnixSeconds ?? 0).UtcDateTime;
if ((DateTime.UtcNow - lastReviewTime).TotalDays >= 8)
var lastReviewTimeUnixSeconds = l.LastReviewTimeUnixSeconds ?? 0;
var lastReviewTime = DateTimeOffset.FromUnixTimeSeconds(lastReviewTimeUnixSeconds).UtcDateTime;

// For some reason the second check wasn't enough to catch this
if (lastReviewTimeUnixSeconds == 0 || (DateTime.UtcNow - lastReviewTime).TotalDays >= 8)
{
return false;
}
Expand Down

0 comments on commit c8d3db5

Please sign in to comment.