From eb79532812fb2d19e416faee91e64a190b702e7c Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 23 Dec 2016 19:00:24 -0500 Subject: [PATCH] Minor fix for PR #3436 --- README.md | 2 +- gogs.go | 2 +- modules/markdown/markdown.go | 19 ++++++++++--------- templates/.VERSION | 2 +- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1a8f035f6..cf9fa42ee 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra ![](https://github.com/gogits/gogs/blob/master/public/img/gogs-large-resize.png?raw=true) -##### Current tip version: 0.9.110 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~) +##### Current tip version: 0.9.111 (see [Releases](https://github.com/gogits/gogs/releases) for binary versions ~~or submit a task on [alpha stage automated binary building system](https://build.gogs.io/)~~) | Web | UI | Preview | |:-------------:|:-------:|:-------:| diff --git a/gogs.go b/gogs.go index 0661e10ff..5c91fca74 100644 --- a/gogs.go +++ b/gogs.go @@ -17,7 +17,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.110.1222" +const APP_VER = "0.9.111.1223" func init() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/modules/markdown/markdown.go b/modules/markdown/markdown.go index d8e6cfc5d..4fbd5a3da 100644 --- a/modules/markdown/markdown.go +++ b/modules/markdown/markdown.go @@ -91,7 +91,7 @@ var ( IssueAlphanumericPattern = regexp.MustCompile(`( |^|\()[A-Z]{1,10}-[1-9][0-9]*\b`) // CrossReferenceIssueNumericPattern matches string that references a numeric issue in a difference repository // e.g. gogits/gogs#12345 - CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z]+/[0-9a-zA-Z]+#[0-9]+\b`) + CrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z-_\.]+/[0-9a-zA-Z-_\.]+#[0-9]+\b`) // Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae // FIXME: this pattern matches pure numbers as well, right now we do a hack to check in RenderSha1CurrentPattern @@ -158,16 +158,16 @@ func (r *Renderer) AutoLink(out *bytes.Buffer, link []byte, kind int) { j = len(m) } - issue := string(m[i+7 : j]) - fullRepoUrl := setting.AppUrl + strings.TrimPrefix(r.urlPrefix, "/") + index := string(m[i+7 : j]) + fullRepoURL := setting.AppUrl + strings.TrimPrefix(r.urlPrefix, "/") var link string - if strings.HasPrefix(string(m), fullRepoUrl) { + if strings.HasPrefix(string(m), fullRepoURL) { // Use a short issue reference if the URL refers to this repository - link = fmt.Sprintf(`#%s`, m, issue) + link = fmt.Sprintf(`#%s`, m, index) } else { // Use a cross-repository issue reference if the URL refers to a different repository repo := string(m[len(setting.AppUrl) : i-1]) - link = fmt.Sprintf(`%s#%s`, m, repo, issue) + link = fmt.Sprintf(`%s#%s`, m, repo, index) } out.WriteString(link) return @@ -284,10 +284,11 @@ func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, me m = m[1:] // ignore leading space or opening parentheses } - repo := string(bytes.Split(m, []byte("#"))[0]) - issue := string(bytes.Split(m, []byte("#"))[1]) + fields := bytes.Split(m, []byte("#"))[0] + repo := string(fields[0]) + index := string(fields[1]) - link := fmt.Sprintf(`%s`, setting.AppUrl, repo, issue, m) + link := fmt.Sprintf(`%s`, setting.AppUrl, repo, index, m) rawBytes = bytes.Replace(rawBytes, m, []byte(link), 1) } return rawBytes diff --git a/templates/.VERSION b/templates/.VERSION index 89e58b46a..1ee4881fe 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.110.1222 \ No newline at end of file +0.9.111.1223 \ No newline at end of file