Merge pull request #3517 from sbwalker/dev

suppress logging for resized image files which no longer exist
This commit is contained in:
Shaun Walker
2023-11-29 13:59:06 -05:00
committed by GitHub

View File

@ -658,8 +658,15 @@ namespace Oqtane.Controllers
}
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");