From 75982db59b5f3801a29bc5eab05b19bfd65fac7e Mon Sep 17 00:00:00 2001 From: Joshua Hesketh <josh@nitrotech.org> Date: Tue, 17 Dec 2013 13:21:30 +1100 Subject: [PATCH] Check for whitespace around changeid searches If a URL contains a change ID such as http://example.org/change/123abc456/log.html then the changeid regex matches the id and tries to turn it into a link like: http://example.org/change/<a href="#q,123abc456,n,z">123abc456</a>/log.html which clearly breaks the original URL. To fix we should check for whitespace or periods around the changeid in the comment. Also, check for <p> tags that gerrit adds to comments for us. Change-Id: Ia337ddfe2ddc82c858072135a613786070f0dc67 --- modules/openstack_project/manifests/gerrit.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index a193d07443..26b13b88dd 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -128,8 +128,8 @@ class openstack_project::gerrit ( commentlinks => [ { name => 'changeid', - match => '(I?[0-9a-f]{8,40})', - link => '#q,$1,n,z', + match => '(<p>|[\\s]+)(I?[0-9a-f]{7,40})(</p>|[\\s.]+)', + html => '$1<a href=\"#q,$2,n,z\">$2</a>$3', }, { name => 'bugheader',