diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-12-03 20:58:38 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-12-03 22:03:17 +0100 |
commit | 00eb481f0bc4fe099ccee5d4a9ab973b2a9885da (patch) | |
tree | 231dd9e0e87fdac8940fb91b9959383ac194e309 | |
parent | Enable short Gentoo Bugzilla URLs in "See Also" (diff) | |
download | bugzilla-00eb481f0bc4fe099ccee5d4a9ab973b2a9885da.tar.gz bugzilla-00eb481f0bc4fe099ccee5d4a9ab973b2a9885da.tar.bz2 bugzilla-00eb481f0bc4fe099ccee5d4a9ab973b2a9885da.zip |
Try treating Gentoo Bugzilla short URLs as local in see alsogentoo-5.0.6.21
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r-- | extensions/Gentoo/lib/GentooBugzilla.pm | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/extensions/Gentoo/lib/GentooBugzilla.pm b/extensions/Gentoo/lib/GentooBugzilla.pm index 9f2a34359..387617bee 100644 --- a/extensions/Gentoo/lib/GentooBugzilla.pm +++ b/extensions/Gentoo/lib/GentooBugzilla.pm @@ -11,7 +11,9 @@ use 5.10.1; use strict; use warnings; -use parent qw(Bugzilla::BugUrl); +use parent qw(Bugzilla::BugUrl::Bugzilla::Local); + +use URI (); ############################### #### Methods #### @@ -23,21 +25,15 @@ sub should_handle { # Gentoo Bugzilla issues have the form of # bugs.gentoo.org/123456 return (lc($uri->authority) eq "bugs.gentoo.org" - && $uri->path =~ m|\d+$|) ? 1 : 0; + && $uri->path =~ m|^/\d+$|) ? 1 : 0; } sub _check_value { - my $class = shift; - - my $uri = $class->SUPER::_check_value(@_); - - # Gentoo Bugzilla redirects to HTTPS, so just use the HTTPS scheme. - $uri->scheme('https'); + my ($class, $uri, undef, $params) = @_; - # And remove any # part if there is one. - $uri->fragment(undef); + my $local_uri = URI->new(substr($uri->path, 1)); - return $uri; + return $class->SUPER::_check_value($local_uri, undef, $params); } 1; |