Launchpad bug references in gerrit comments do not filter out period at end of sentence

Bug #1222217 reported by Clint Byrum
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Core Infrastructure
Fix Released
Low
Yolanda Robla

Bug Description

The comment from Joe Gordon referencing bug #1221987 demonstrates the problem: https://review.openstack.org/#/c/45462/

The period at the end of the bug should not be part of the link. Most likely a regex that needs a tightened up character class or something.

James E. Blair (corvus)
tags: added: low-hanging-fruit
Changed in openstack-ci:
status: New → Triaged
importance: Undecided → Low
milestone: none → havana
Revision history for this message
Yolanda Robla (yolanda.robla) wrote :

I'm happy to take this bug as an initial collaboration, is ok to proceed with that?

Changed in openstack-ci:
assignee: nobody → Yolanda Robla (yolanda.robla)
Revision history for this message
Elizabeth K. Joseph (lyz) wrote :

Please do, thank you!

Revision history for this message
Yolanda Robla (yolanda.robla) wrote :

So problem is with linkify() method, that belongs to SafeHtmlBuilder class from com.google.gwtexpui.safehtml.client library
Actually, periods can be a valid part of an url so it's not really a problem but a particular case. Also some other can put any other sign after the launchpad bug, not limited to the case of a dot.

I managed to remove periods with a commentlink in gerrit.config:

[commentlink "launchpadbug"]
        match = <a href=\"(https://bugs\\.launchpad\\.net/[a-zA-Z0-9\\-]+/\\+bug/(\\d+))[^\"]+\">[^<]+</a>
        html = <a href=\"$1\">$1</a>

By this way we validate that launchpad bugs follow the right pattern, just stripping anything after bug number. Is ok to proceed with a fix like that in gerrit puppet file?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to config (master)

Fix proposed to branch: master
Review: https://review.openstack.org/55666

Changed in openstack-ci:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to config (master)

Reviewed: https://review.openstack.org/55666
Committed: http://github.com/openstack-infra/config/commit/5442230546f299949319ab0172ce0fd44144f14a
Submitter: Jenkins
Branch: master

commit 5442230546f299949319ab0172ce0fd44144f14a
Author: Yolanda Robla <email address hidden>
Date: Fri Nov 8 23:03:32 2013 +0800

    Remove extra chars in launchpad bug links

    Add a new commentlink section in gerrit.config that parses
    launchpad bug links pattern and removes any trailing char
    after the bug number, to prevent including dots, question marks
    or any other trailing char to be included in the link

    Closes-Bug: 1222217

    Change-Id: I402b75cea39cda01829bee6b1762e9abe54d85d4

Changed in openstack-ci:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.