summaryrefslogtreecommitdiffstats
path: root/modules/base
diff options
context:
space:
mode:
author无闻 <u@gogs.io>2015-02-06 19:03:35 -0500
committer无闻 <u@gogs.io>2015-02-06 19:03:35 -0500
commitddddad9792d203c3ac3e6406aac0bf38235018dd (patch)
tree9a22b4e6c6d4196d173e2af28ae3d55e249d731b /modules/base
parent16018e832394772591688a261646d3a80787ac9d (diff)
parent04d698bfbcb4ee584700e5ff3134dd74e1688c1b (diff)
downloadgitea-ddddad9792d203c3ac3e6406aac0bf38235018dd.tar.gz
gitea-ddddad9792d203c3ac3e6406aac0bf38235018dd.zip
Merge pull request #826 from deringer/dev
Fix user mention bug when parsing markdown documents
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/markdown.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index d3f3e5feaf..87aafda3e1 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -106,7 +106,7 @@ func (options *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte,
}
var (
- MentionPattern = regexp.MustCompile(`@[0-9a-zA-Z_]{1,}`)
+ MentionPattern = regexp.MustCompile(`(\s@)[0-9a-zA-Z_]{1,}`)
commitPattern = regexp.MustCompile(`(\s|^)https?.*commit/[0-9a-zA-Z]+(#+[0-9a-zA-Z-]*)?`)
issueFullPattern = regexp.MustCompile(`(\s|^)https?.*issues/[0-9]+(#+[0-9a-zA-Z-]*)?`)
issueIndexPattern = regexp.MustCompile(`( |^)#[0-9]+`)
@@ -129,7 +129,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
ms := MentionPattern.FindAll(line, -1)
for _, m := range ms {
line = bytes.Replace(line, m,
- []byte(fmt.Sprintf(`<a href="%s/user/%s">%s</a>`, setting.AppSubUrl, m[1:], m)), -1)
+ []byte(fmt.Sprintf(`<a href="%s/%s">%s</a>`, setting.AppSubUrl, m[2:], m)), -1)
}
}