mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 18:24:14 +01:00
Backport #28582 by @Zettat123 Fix #28570 Follow #24633 --- Copied from https://github.com/go-gitea/gitea/issues/28570#issuecomment-1867327999 The feature introduced in #24633 should be compatible with `status_check_contexts`. However, if one or more of `status_check_contexts` is not a legal glob expressions, `glob.Compile` will fail and the contexts cannot match.21229ed2c8/routers/web/repo/pull.go (L653-L663)
Co-authored-by: Zettat123 <zettat123@gmail.com> (cherry picked from commit6a559ad634
)
This commit is contained in:
parent
9ad7a67fc1
commit
3fe44b8762
1 changed files with 9 additions and 1 deletions
|
@ -637,7 +637,15 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
|
|||
if pb != nil && pb.EnableStatusCheck {
|
||||
ctx.Data["is_context_required"] = func(context string) bool {
|
||||
for _, c := range pb.StatusCheckContexts {
|
||||
if gp, err := glob.Compile(c); err == nil && gp.Match(context) {
|
||||
if c == context {
|
||||
return true
|
||||
}
|
||||
if gp, err := glob.Compile(c); err != nil {
|
||||
// All newly created status_check_contexts are checked to ensure they are valid glob expressions before being stored in the database.
|
||||
// But some old status_check_context created before glob was introduced may be invalid glob expressions.
|
||||
// So log the error here for debugging.
|
||||
log.Error("compile glob %q: %v", c, err)
|
||||
} else if gp.Match(context) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue