mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-24 01:24:39 +02:00
fix: add missing checks to several handlers and models (#39839)
Several handlers and model helpers skipped checks that their siblings already perform. - Only match principal keys when looking up SSH certificate principals - Return no attachments for an unsaved issue instead of every issue-less one - Reject issue and comment attachments when adding release attachments - Share one permission check for editing, deleting and reacting to issue content and for comment attachments between the web UI and the API, refusing them on locked issues for users who can't write - Reject issue edits, deletion and label changes in archived repositories via the API - Apply cross-origin protection to the repository topics endpoint - Return 404 for the repositories tab of individual users and respect profile visibility for the heatmap Fixes: https://github.com/go-gitea/gitea/issues/39226 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
28 files changed
+290
-221
No files matched your search
@@ -38,15 +38,20 @@ func Home(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
home(ctx, false)
|
||||
orgHome(ctx, false)
|
||||
}
|
||||
|
||||
func Repositories(ctx *context.Context) {
|
||||
home(ctx, true)
|
||||
orgHome(ctx, true)
|
||||
}
|
||||
|
||||
func home(ctx *context.Context, viewRepositories bool) {
|
||||
func orgHome(ctx *context.Context, viewRepositories bool) {
|
||||
org := ctx.Org.Organization
|
||||
if org == nil {
|
||||
// some requests may reach here by "user" route patterns, e.g.: "/{owner}/-/repositories"
|
||||
ctx.NotFound(nil)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["PageIsUserProfile"] = true
|
||||
ctx.Data["Title"] = org.DisplayName()
|
||||
|
||||
Reference in new issue
Block a user