-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix commit sha1 URL rendering in markdown #1677
Conversation
@@ -296,6 +296,7 @@ func TestRender_Commits(t *testing.T) { | |||
test(sha, `<p><a href="`+commit+`" rel="nofollow">b6dd6210ea</a></p>`) | |||
test(commit, `<p><a href="`+commit+`" rel="nofollow">b6dd6210ea</a></p>`) | |||
test(tree, `<p><a href="`+src+`" rel="nofollow">b6dd6210ea/src</a></p>`) | |||
test("commit "+sha, `<p>commit <a href="`+commit+`" rel="nofollow">b6dd6210ea</a></p>`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I won't ask for this PR but it would be better if the short sha is not hardcoded but derived from sha in test result (in the future ^^).
modules/markdown/markdown.go
Outdated
@@ -542,7 +542,7 @@ func RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, me | |||
func renderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte { | |||
ms := Sha1CurrentPattern.FindAllSubmatch(rawBytes, -1) | |||
for _, m := range ms { | |||
all := m[0] | |||
all := m[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should not call it all
now that it right fully catch only the commitId/sha1.
I have made two comments that are non blocking just improvement. Otherwise LGTM. |
LGTM |
Changed variable name as requested :) |
Fixes #1667