Skip to content

Commit c32245d

Browse files
author
moritz
committed
[irclog] handle #bioclipse's weird revision links
git-svn-id: http://svn.pugscode.org/pugs/misc/irclog@17194 c213334d-75ef-0310-aa23-eaa082d1ae64
1 parent 597e3c6 commit c32245d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

IrcLog/WWW.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ sub revision_links {
121121
);
122122
my $url_prefix = $prefixes{$channel};
123123
return $r unless $url_prefix;
124-
$r =~ s/^r//;
124+
$r =~ s/^r\x{02}?//;
125125
return qq{<a href="$url_prefix$r" title="Changeset for r$r">r$r</a>};
126126
}
127127

@@ -258,7 +258,10 @@ my %output_chain = (
258258
rest => 'revision_links',
259259
},
260260
revision_links => {
261-
re => qr/\br[1-9]\d*\b/,
261+
# regex cludge: on #bioclipse the revision numbers by some
262+
# weird bot contain non-printable characters for formating
263+
# purposes
264+
re => qr/\br\x{02}?[1-9]\d*\b/,
262265
match => \&revision_links,
263266
rest => 'email_obfuscate',
264267
},

t/revision-links.t

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use strict;
22
use warnings;
3-
use Test::More tests => 5;
3+
use Test::More tests => 6;
44

55
BEGIN { use_ok('IrcLog::WWW'); }
66

@@ -49,6 +49,11 @@ my @tests = (
4949
result => undef,
5050
desc => 'r0\d+ does not linkify',
5151
},
52+
{
53+
test => 'r' . chr(2) . '123',
54+
result => 'r123',
55+
desc => 'revision links with chr(02) after the r still work',
56+
}
5257
);
5358

5459
for my $h (@tests){

0 commit comments

Comments
 (0)