Explorar el Código

Fix bad issue links in non-readme markdown files

Howl hace 9 años
padre
commit
85c58eba90
Se han modificado 1 ficheros con 3 adiciones y 0 borrados
  1. 3 0
      modules/base/markdown.go

+ 3 - 0
modules/base/markdown.go

@@ -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