From 00eb481f0bc4fe099ccee5d4a9ab973b2a9885da Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 3 Dec 2022 20:58:38 +0100 Subject: Try treating Gentoo Bugzilla short URLs as local in see also MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- extensions/Gentoo/lib/GentooBugzilla.pm | 18 +++++++----------- 1 file 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; -- cgit v1.2.3-65-gdbad