Skip to content

Commit

Permalink
Merge pull request #3517 from sbwalker/dev
Browse files Browse the repository at this point in the history
suppress logging for resized image files which no longer exist
  • Loading branch information
sbwalker committed Nov 29, 2023
2 parents c76946c + 077343c commit 73aca22
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Oqtane.Server/Controllers/FileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,15 @@ public IActionResult GetImage(int id, int width, int height, string mode, string
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Access Attempt {FileId}", id);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
if (file != null)
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Access Attempt {FileId}", id);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
}
else
{
HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound;
}
}

string errorPath = Path.Combine(GetFolderPath("wwwroot/images"), "error.png");
Expand Down

0 comments on commit 73aca22

Please sign in to comment.