]> source.dussan.org Git - gitea.git/commitdiff
Fix bad issue links in non-readme markdown files
authorHowl <git@howl.moe>
Sun, 15 Nov 2015 11:04:43 +0000 (12:04 +0100)
committerHowl <git@howl.moe>
Sun, 15 Nov 2015 11:04:43 +0000 (12:04 +0100)
modules/base/markdown.go

index 8f3d6bef1a195590920dfe6ff4ffc1f607a96d71..70c2918af0793c56fc5c0eab4d95af0cbb206997 100644 (file)
@@ -168,6 +168,9 @@ func RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte {
 }
 
 func RenderIssueIndexPattern(rawBytes []byte, urlPrefix string) []byte {
+       // Remove unnecessary things after username and reponame in prefix
+       // (otherwise stuff like /:user/:repo/src/master/issues/1 would happen)
+       urlPrefix = strings.Join(strings.Split(urlPrefix, "/")[:3], "/")
        ms := issueIndexPattern.FindAll(rawBytes, -1)
        for _, m := range ms {
                var space string