From 0d73dcaf0f5b40486cc80fd7976a98e88f2aa672 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 28 Jan 2017 09:40:32 -0500 Subject: Fix cross-repository reference link error (#4025) --- gogs.go | 2 +- modules/markdown/markdown.go | 7 ++++--- templates/.VERSION | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gogs.go b/gogs.go index 101ff548..7a7604d6 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.122.0128" +const APP_VER = "0.9.123.0128" func init() { setting.AppVer = APP_VER diff --git a/modules/markdown/markdown.go b/modules/markdown/markdown.go index 4fbd5a3d..7458186f 100644 --- a/modules/markdown/markdown.go +++ b/modules/markdown/markdown.go @@ -196,6 +196,7 @@ var ( svgSuffixWithMark = []byte(".svg?") spaceBytes = []byte(" ") spaceEncodedBytes = []byte("%20") + pound = []byte("#") space = " " spaceEncoded = "%20" ) @@ -284,9 +285,9 @@ func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, me m = m[1:] // ignore leading space or opening parentheses } - fields := bytes.Split(m, []byte("#"))[0] - repo := string(fields[0]) - index := string(fields[1]) + delimIdx := bytes.Index(m, pound) + repo := string(m[:delimIdx]) + index := string(m[delimIdx+1:]) link := fmt.Sprintf(`%s`, setting.AppUrl, repo, index, m) rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1) diff --git a/templates/.VERSION b/templates/.VERSION index bdf9e88a..7d9dc496 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.122.0128 \ No newline at end of file +0.9.123.0128 \ No newline at end of file -- cgit v1.2.3