mirror of
https://github.com/go-gitea/gitea.git
synced 2026-12-03 21:32:25 -06:00
The glob compiler wrote a backslash followed by the escaped character into the generated regexp, so `\d`, `\w`, `\s` and `\b` were parsed as regexp constructs instead of the literal character. `a\d` compiled to `^a\d$` and matched "a5" instead of "ad"; `a\b` became a zero-width word boundary. Escaping a character Go does not recognise, e.g. `\C`, made the pattern fail to compile, and protected branch rules then fell back to matching the raw rule text literally. Escape only ASCII punctuation, which Go always reads as a literal, and write letters, digits and non-ASCII characters as-is. This matches gobwas/glob and act. Rules that relied on `\d` matching a digit since https://github.com/go-gitea/gitea/pull/35478 now match a literal `d`. Assisted-by: OpenCode (DeepSeek V4.1 Flash) Assisted-by: Claude Code:claude-opus-5-5 --------- Co-authored-by: silverwind <me@silverwind.io>