QChris has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/64502


Change subject: Stop gerrit's commit link detection from mangling MediaWiki Urls
......................................................................

Stop gerrit's commit link detection from mangling MediaWiki Urls

The regular expression for commit links did not check for characters
before the hexadecimal string. So it matched on Urls in commit
messages that contained a sufficiently long number, as for example

  Per talk on 
https://de.wikipedia.org/w/index.php?title=Benutzer_Diskussion:Raymond&oldid=115044733#Lua_in_weiteren_Wikipedien

There, Gerrit wrapped the https link itself in an <a> element, but
also the oldid parameter, which resulted in garbled output. Since
fixing the highlighting directly in Gerrit is unproportionally more
complicated, we fix the problem for us by restricting the characters
that may occur before a commit hash.

Bug: #45780
Change-Id: I53449559bdcb70146102a7b07bb4be9ae3b11e48
---
M templates/gerrit/gerrit.config.erb
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/02/64502/1

diff --git a/templates/gerrit/gerrit.config.erb 
b/templates/gerrit/gerrit.config.erb
index b1ece2e..36b94a6 100644
--- a/templates/gerrit/gerrit.config.erb
+++ b/templates/gerrit/gerrit.config.erb
@@ -60,8 +60,8 @@
        match = \\b(I[0-9a-f]{7,40})\\b
        link = "#q,$1,n,z"
 [commentlink "commit"]
-       match = \\b([0-9a-f]{7,40})\\b
-       link = "#q,$1,n,z"
+       match = (^|\\s|[:.,!?])([0-9a-f]{7,40})\\b
+       link = "#q,$2,n,z"
 [commentlink "bugzilla"]
        match =  "\\b[bB][uU][gG]\\:?\\s+#?(\\d+)\\b"
        link = https://bugzilla.wikimedia.org/$1

-- 
To view, visit https://gerrit.wikimedia.org/r/64502
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I53449559bdcb70146102a7b07bb4be9ae3b11e48
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: QChris <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to