Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent logging of error for personalized pages #2994

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Oqtane.Server/Controllers/FileController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,8 @@ public Models.File Get(string name, int folderId)
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized File Get Attempt {Name} For Folder {FolderId}", name, folderId);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
file = null;
}
return file;
return null;
}
}

Expand Down
11 changes: 7 additions & 4 deletions Oqtane.Server/Controllers/PageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ public Page Get(string path, int siteid)
}
else
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Page Get Attempt {SiteId} {Path}", siteid, path);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
if (page != null)
{
_logger.Log(LogLevel.Error, this, LogFunction.Security, "Unauthorized Page Get Attempt {SiteId} {Path}", siteid, path);
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
}
return null;
}
}
Expand Down Expand Up @@ -177,8 +180,8 @@ public Page Post(int id, string userid)
page = new Page();
page.SiteId = parent.SiteId;
page.ParentId = parent.PageId;
page.Name = user.DisplayName != null ? user.DisplayName : user.Username;
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(page.Name);
page.Name = user.Username;
page.Path = parent.Path + "/" + page.Name;
page.Title = page.Name + " - " + parent.Name;
page.Order = 0;
page.IsNavigation = false;
Expand Down