mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-18 22:36:43 +09:00
fix: handle git branch name with special chars correctly (#39483)
Fix the bugs: * Commit graph page doesn't show * PR command line instructions are wrong --------- Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
1 parent
a71c5c94c5
commit
fe31237fd8
7 files changed
+56
-33
No files matched your search
@@ -36,6 +36,7 @@ import "strings"
|
||||
|
||||
const (
|
||||
tildePrefix = '~'
|
||||
commentPrefix = '#'
|
||||
needsEscape = " \t\n|&;()<>${}[]*?!\"'`\\"
|
||||
needsSingleQuote = "!\n"
|
||||
)
|
||||
@@ -74,7 +75,7 @@ func ShellEscape(toEscape string) string {
|
||||
}
|
||||
|
||||
// Now for simplicity we'll look at the rest of the string
|
||||
if !strings.ContainsAny(toEscape[start:], needsEscape) {
|
||||
if !strings.ContainsAny(toEscape[start:], needsEscape) && toEscape[0] != commentPrefix {
|
||||
return toEscape
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user