forked from NYANDEV/forgejo
minor fix for #1949
This commit is contained in:
parent
e030109b5a
commit
1a901433e2
1 changed files with 14 additions and 3 deletions
|
@ -167,10 +167,21 @@ func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
|
||||||
return rawBytes
|
return rawBytes
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string) []byte {
|
func cutoutVerbosePrefix(prefix string) string {
|
||||||
if i := strings.Index(urlPrefix, "/src"); i != -1 {
|
count := 0
|
||||||
urlPrefix = urlPrefix[:i]
|
for i := 0; i < len(prefix); i++ {
|
||||||
|
if prefix[i] == '/' {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
if count >= 3 {
|
||||||
|
return prefix[:i]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return prefix
|
||||||
|
}
|
||||||
|
|
||||||
|
func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string) []byte {
|
||||||
|
urlPrefix = cutoutVerbosePrefix(urlPrefix)
|
||||||
ms := issueIndexPattern.FindAll(rawBytes, -1)
|
ms := issueIndexPattern.FindAll(rawBytes, -1)
|
||||||
for _, m := range ms {
|
for _, m := range ms {
|
||||||
var space string
|
var space string
|
||||||
|
|
Loading…
Reference in a new issue