diff options
Diffstat (limited to 'extensions/MoreBugUrl/lib')
-rw-r--r-- | extensions/MoreBugUrl/lib/BitBucket.pm | 20 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/GetSatisfaction.pm | 22 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/PHP.pm | 26 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/Phabricator.pm | 23 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/RT.pm | 25 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/Redmine.pm | 23 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/ReviewBoard.pm | 31 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/Rietveld.pm | 48 | ||||
-rw-r--r-- | extensions/MoreBugUrl/lib/Savane.pm | 27 |
9 files changed, 127 insertions, 118 deletions
diff --git a/extensions/MoreBugUrl/lib/BitBucket.pm b/extensions/MoreBugUrl/lib/BitBucket.pm index dcc85992d..683f9aeb3 100644 --- a/extensions/MoreBugUrl/lib/BitBucket.pm +++ b/extensions/MoreBugUrl/lib/BitBucket.pm @@ -18,23 +18,23 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; + my ($class, $uri) = @_; - # BitBucket issues have the form of - # bitbucket.org/user/project/issue/1234 - return (lc($uri->authority) eq "bitbucket.org" - && $uri->path =~ m|[^/]+/[^/]+/issue/\d+|i) ? 1 : 0; + # BitBucket issues have the form of + # bitbucket.org/user/project/issue/1234 + return (lc($uri->authority) eq "bitbucket.org" + && $uri->path =~ m|[^/]+/[^/]+/issue/\d+|i) ? 1 : 0; } sub _check_value { - my $class = shift; + my $class = shift; - my $uri = $class->SUPER::_check_value(@_); + my $uri = $class->SUPER::_check_value(@_); - my ($path) = $uri->path =~ m|([^/]+/[^/]+/issue/\d+)|i; - $uri = new URI("https://bitbucket.org/$path"); + my ($path) = $uri->path =~ m|([^/]+/[^/]+/issue/\d+)|i; + $uri = new URI("https://bitbucket.org/$path"); - return $uri; + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/GetSatisfaction.pm b/extensions/MoreBugUrl/lib/GetSatisfaction.pm index 74951735b..34c86b65f 100644 --- a/extensions/MoreBugUrl/lib/GetSatisfaction.pm +++ b/extensions/MoreBugUrl/lib/GetSatisfaction.pm @@ -18,24 +18,24 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; + my ($class, $uri) = @_; - # GetSatisfaction URLs only have one form: - # http(s)://getsatisfaction.com/PROJECT_NAME/topics/TOPIC_NAME - return (lc($uri->authority) eq 'getsatisfaction.com' - and $uri->path =~ m|^/[^/]+/topics/[^/]+$|) ? 1 : 0; + # GetSatisfaction URLs only have one form: + # http(s)://getsatisfaction.com/PROJECT_NAME/topics/TOPIC_NAME + return (lc($uri->authority) eq 'getsatisfaction.com' + and $uri->path =~ m|^/[^/]+/topics/[^/]+$|) ? 1 : 0; } sub _check_value { - my ($class, $uri) = @_; + my ($class, $uri) = @_; - $uri = $class->SUPER::_check_value($uri); + $uri = $class->SUPER::_check_value($uri); - # GetSatisfaction HTTP URLs redirect to HTTPS, so just use the HTTPS - # scheme. - $uri->scheme('https'); + # GetSatisfaction HTTP URLs redirect to HTTPS, so just use the HTTPS + # scheme. + $uri->scheme('https'); - return $uri; + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/PHP.pm b/extensions/MoreBugUrl/lib/PHP.pm index 6f201d7b1..9419bcd14 100644 --- a/extensions/MoreBugUrl/lib/PHP.pm +++ b/extensions/MoreBugUrl/lib/PHP.pm @@ -18,27 +18,27 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; + my ($class, $uri) = @_; - # PHP Bug URLs have only one form: - # https://bugs.php.net/bug.php?id=1234 - return (lc($uri->authority) eq 'bugs.php.net' - and $uri->path =~ m|/bug\.php$| - and $uri->query_param('id') =~ /^\d+$/) ? 1 : 0; + # PHP Bug URLs have only one form: + # https://bugs.php.net/bug.php?id=1234 + return (lc($uri->authority) eq 'bugs.php.net' + and $uri->path =~ m|/bug\.php$| + and $uri->query_param('id') =~ /^\d+$/) ? 1 : 0; } sub _check_value { - my $class = shift; + my $class = shift; - my $uri = $class->SUPER::_check_value(@_); + my $uri = $class->SUPER::_check_value(@_); - # PHP Bug URLs redirect to HTTPS, so just use the HTTPS scheme. - $uri->scheme('https'); + # PHP Bug URLs redirect to HTTPS, so just use the HTTPS scheme. + $uri->scheme('https'); - # And remove any # part if there is one. - $uri->fragment(undef); + # And remove any # part if there is one. + $uri->fragment(undef); - return $uri; + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/Phabricator.pm b/extensions/MoreBugUrl/lib/Phabricator.pm index 818d9af8f..0822663ad 100644 --- a/extensions/MoreBugUrl/lib/Phabricator.pm +++ b/extensions/MoreBugUrl/lib/Phabricator.pm @@ -18,24 +18,25 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; - return ($uri->path =~ m|^/T\d+$|) ? 1 : 0; + my ($class, $uri) = @_; + return ($uri->path =~ m|^/T\d+$|) ? 1 : 0; } sub _check_value { - my $class = shift; + my $class = shift; - my $uri = $class->SUPER::_check_value(@_); + my $uri = $class->SUPER::_check_value(@_); - # Phabricator URLs have only one form: - # http://example.com/T111 + # Phabricator URLs have only one form: + # http://example.com/T111 - # Make sure there are no query parameters. - $uri->query(undef); - # And remove any # part if there is one. - $uri->fragment(undef); + # Make sure there are no query parameters. + $uri->query(undef); - return $uri; + # And remove any # part if there is one. + $uri->fragment(undef); + + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/RT.pm b/extensions/MoreBugUrl/lib/RT.pm index acb90cf39..54dc2dd4c 100644 --- a/extensions/MoreBugUrl/lib/RT.pm +++ b/extensions/MoreBugUrl/lib/RT.pm @@ -18,24 +18,25 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; - - # RT URLs can look like various things: - # http://example.com/rt/Ticket/Display.html?id=1234 - # https://example.com/Public/Bug/Display.html?id=1234 - return ($uri->path =~ m|/Display\.html$| - and $uri->query_param('id') =~ /^\d+$/) ? 1 : 0; + my ($class, $uri) = @_; + + # RT URLs can look like various things: + # http://example.com/rt/Ticket/Display.html?id=1234 + # https://example.com/Public/Bug/Display.html?id=1234 + return ($uri->path =~ m|/Display\.html$| and $uri->query_param('id') =~ /^\d+$/) + ? 1 + : 0; } sub _check_value { - my $class = shift; + my $class = shift; - my $uri = $class->SUPER::_check_value(@_); + my $uri = $class->SUPER::_check_value(@_); - # And remove any # part if there is one. - $uri->fragment(undef); + # And remove any # part if there is one. + $uri->fragment(undef); - return $uri; + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/Redmine.pm b/extensions/MoreBugUrl/lib/Redmine.pm index 57a071239..712dab197 100644 --- a/extensions/MoreBugUrl/lib/Redmine.pm +++ b/extensions/MoreBugUrl/lib/Redmine.pm @@ -18,24 +18,25 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; - return ($uri->path =~ m|/issues/\d+$|) ? 1 : 0; + my ($class, $uri) = @_; + return ($uri->path =~ m|/issues/\d+$|) ? 1 : 0; } sub _check_value { - my $class = shift; + my $class = shift; - my $uri = $class->SUPER::_check_value(@_); + my $uri = $class->SUPER::_check_value(@_); - # Redmine URLs have only one form: - # http://demo.redmine.com/issues/111 + # Redmine URLs have only one form: + # http://demo.redmine.com/issues/111 - # Make sure there are no query parameters. - $uri->query(undef); - # And remove any # part if there is one. - $uri->fragment(undef); + # Make sure there are no query parameters. + $uri->query(undef); - return $uri; + # And remove any # part if there is one. + $uri->fragment(undef); + + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/ReviewBoard.pm b/extensions/MoreBugUrl/lib/ReviewBoard.pm index af5ff0684..48cbecf11 100644 --- a/extensions/MoreBugUrl/lib/ReviewBoard.pm +++ b/extensions/MoreBugUrl/lib/ReviewBoard.pm @@ -18,29 +18,30 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; - return ($uri->path =~ m|/r/\d+/?$|) ? 1 : 0; + my ($class, $uri) = @_; + return ($uri->path =~ m|/r/\d+/?$|) ? 1 : 0; } sub _check_value { - my $class = shift; + my $class = shift; - my $uri = $class->SUPER::_check_value(@_); + my $uri = $class->SUPER::_check_value(@_); - # Review Board URLs have only one form (the trailing slash is optional): - # http://reviews.reviewboard.org/r/111/ + # Review Board URLs have only one form (the trailing slash is optional): + # http://reviews.reviewboard.org/r/111/ - # Make sure there are no query parameters. - $uri->query(undef); - # And remove any # part if there is one. - $uri->fragment(undef); + # Make sure there are no query parameters. + $uri->query(undef); - # make sure the trailing slash is present - if ($uri->path !~ m|/$|) { - $uri->path($uri->path . '/'); - } + # And remove any # part if there is one. + $uri->fragment(undef); - return $uri; + # make sure the trailing slash is present + if ($uri->path !~ m|/$|) { + $uri->path($uri->path . '/'); + } + + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/Rietveld.pm b/extensions/MoreBugUrl/lib/Rietveld.pm index a4bf08492..55a18b0b2 100644 --- a/extensions/MoreBugUrl/lib/Rietveld.pm +++ b/extensions/MoreBugUrl/lib/Rietveld.pm @@ -18,32 +18,34 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; - return ($uri->authority =~ /\.appspot\.com$/i - and $uri->path =~ m#^/\d+(?:/|/show)?$#) ? 1 : 0; + my ($class, $uri) = @_; + return ($uri->authority =~ /\.appspot\.com$/i + and $uri->path =~ m#^/\d+(?:/|/show)?$#) ? 1 : 0; } sub _check_value { - my ($class, $uri) = @_; - - $uri = $class->SUPER::_check_value($uri); - - # Rietveld URLs have three forms: - # http(s)://example.appspot.com/1234 - # http(s)://example.appspot.com/1234/ - # http(s)://example.appspot.com/1234/show - if ($uri->path =~ m#^/(\d+)(?:/|/show)$#) { - # This is the shortest standard URL form for Rietveld issues, - # and so we reduce all URLs to this. - $uri->path('/' . $1); - } - - # Make sure there are no query parameters. - $uri->query(undef); - # And remove any # part if there is one. - $uri->fragment(undef); - - return $uri; + my ($class, $uri) = @_; + + $uri = $class->SUPER::_check_value($uri); + + # Rietveld URLs have three forms: + # http(s)://example.appspot.com/1234 + # http(s)://example.appspot.com/1234/ + # http(s)://example.appspot.com/1234/show + if ($uri->path =~ m#^/(\d+)(?:/|/show)$#) { + + # This is the shortest standard URL form for Rietveld issues, + # and so we reduce all URLs to this. + $uri->path('/' . $1); + } + + # Make sure there are no query parameters. + $uri->query(undef); + + # And remove any # part if there is one. + $uri->fragment(undef); + + return $uri; } 1; diff --git a/extensions/MoreBugUrl/lib/Savane.pm b/extensions/MoreBugUrl/lib/Savane.pm index 5b35bbf7d..717878b33 100644 --- a/extensions/MoreBugUrl/lib/Savane.pm +++ b/extensions/MoreBugUrl/lib/Savane.pm @@ -18,24 +18,27 @@ use parent qw(Bugzilla::BugUrl); ############################### sub should_handle { - my ($class, $uri) = @_; - # Savane URLs look like the following (the index.php is optional): - # https://savannah.gnu.org/bugs/index.php?107657 - # https://savannah.gnu.org/patch/index.php?107657 - # https://savannah.gnu.org/support/index.php?107657 - # https://savannah.gnu.org/task/index.php?107657 - return ($uri->as_string =~ m|/(bugs\|patch\|support\|task)/(index\.php)?\?\d+$|) ? 1 : 0; + my ($class, $uri) = @_; + + # Savane URLs look like the following (the index.php is optional): + # https://savannah.gnu.org/bugs/index.php?107657 + # https://savannah.gnu.org/patch/index.php?107657 + # https://savannah.gnu.org/support/index.php?107657 + # https://savannah.gnu.org/task/index.php?107657 + return ($uri->as_string =~ m|/(bugs\|patch\|support\|task)/(index\.php)?\?\d+$|) + ? 1 + : 0; } sub _check_value { - my $class = shift; + my $class = shift; - my $uri = $class->SUPER::_check_value(@_); + my $uri = $class->SUPER::_check_value(@_); - # And remove any # part if there is one. - $uri->fragment(undef); + # And remove any # part if there is one. + $uri->fragment(undef); - return $uri; + return $uri; } 1; |