From 67346e9e26ed523829f1beaed65f07252ea83b61 Mon Sep 17 00:00:00 2001 From: Tiago Mello Date: Mon, 19 Sep 2011 20:43:40 -0300 Subject: Bug 686967: Fix incoherent code in Bugzilla::BugUrl::Bugzilla::Local->should_handle() r/a=LpSolit --- Bugzilla/BugUrl/Bugzilla/Local.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Bugzilla/BugUrl') diff --git a/Bugzilla/BugUrl/Bugzilla/Local.pm b/Bugzilla/BugUrl/Bugzilla/Local.pm index c052d7d3b..9260ba1cb 100644 --- a/Bugzilla/BugUrl/Bugzilla/Local.pm +++ b/Bugzilla/BugUrl/Bugzilla/Local.pm @@ -95,13 +95,20 @@ sub remove_from_db { sub should_handle { my ($class, $uri) = @_; - return $uri->as_string =~ m/^\w+$/ ? 1 : 0; + # Check if it is either a bug id number or an alias. + return 1 if $uri->as_string =~ m/^\w+$/; + # Check if it is a local Bugzilla uri and call + # Bugzilla::BugUrl::Bugzilla to check if it's a valid Bugzilla + # see also url. my $canonical_local = URI->new($class->local_uri)->canonical; + if ($canonical_local->authority eq $uri->canonical->authority + and $canonical_local->path eq $uri->canonical->path) + { + return $class->SUPER::should_handle($uri); + } - # Treating the domain case-insensitively and ignoring http(s):// - return ($canonical_local->authority eq $uri->canonical->authority - and $canonical_local->path eq $uri->canonical->path) ? 1 : 0; + return 0; } sub _check_value { -- cgit v1.2.3-24-g4f1b