Skip to content

Commit

Permalink
Displayed text link uses matched group 1 while generate link uses mat…
Browse files Browse the repository at this point in the history
…ched group 2 due to another regex handing trac.webkit.org link.

https://bugs.webkit.org/show_bug.cgi?id=246692
rdar://problem/101297471

Reviewed by Jonathan Bedard.

* Websites/bugs.webkit.org/extensions/Commits/Extension.pm:
(bug_format_comment):

sub _replace_reference {
    my $args = shift;
    my $text = $args->{matches}->[0];
    my $reference = $args->{matches}->[1];
    return qq{<a href="https://commits.webkit.org/$reference">$text</a>};
};
My last patch left out a parentesis pair causing group 2 to be NULL.

Canonical link: https://commits.webkit.org/255732@main
  • Loading branch information
lingcherd authored and JonWBedard committed Oct 19, 2022
1 parent 9ab9d3a commit 3f0b2fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Websites/bugs.webkit.org/extensions/Commits/Extension.pm
Expand Up @@ -36,8 +36,8 @@ sub bug_format_comment {
# Should match "r12345" and "trac.webkit.org/r12345" but not "https://trac.webkit.org/r12345"
push(@$regexes, { match => qr/(?<!\/|\#)\b((r[[:digit:]]{5,}))\b/, replace => \&_replace_reference });
push(@$regexes, { match => qr/(?<!\/)(trac.webkit.org\/(r[[:digit:]]{5,}))\b/, replace => \&_replace_reference });
push(@$regexes, { match => qr/\b(?<!https:\/\/)(?<!\/|\x{2026}|\.)(\d+@\S+)\b/, replace => \&_replace_reference });
push(@$regexes, { match => qr/\b(?<!https:\/\/)(?<!\/|\x{2026}|\.)(\d+\.?\d+@\S+)\b/, replace => \&_replace_reference });
push(@$regexes, { match => qr/\b((?<!https:\/\/)(?<!\/|\x{2026}|\.)(\d+@\S+))\b/, replace => \&_replace_reference });
push(@$regexes, { match => qr/\b((?<!https:\/\/)(?<!\/|\x{2026}|\.)(\d+\.?\d+@\S+))\b/, replace => \&_replace_reference });
}

sub _replace_reference {
Expand Down

0 comments on commit 3f0b2fe

Please sign in to comment.