summaryrefslogtreecommitdiffstats
path: root/Bugzilla/BugUrl
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/BugUrl')
-rw-r--r--Bugzilla/BugUrl/Aha.pm22
-rw-r--r--Bugzilla/BugUrl/Bugzilla.pm52
-rw-r--r--Bugzilla/BugUrl/Bugzilla/Local.pm121
-rw-r--r--Bugzilla/BugUrl/Chromium.pm41
-rw-r--r--Bugzilla/BugUrl/Debian.pm48
-rw-r--r--Bugzilla/BugUrl/Edge.pm16
-rw-r--r--Bugzilla/BugUrl/GitHub.pm26
-rw-r--r--Bugzilla/BugUrl/Google.pm58
-rw-r--r--Bugzilla/BugUrl/JIRA.pm25
-rw-r--r--Bugzilla/BugUrl/Launchpad.pm44
-rw-r--r--Bugzilla/BugUrl/MantisBT.pm18
-rw-r--r--Bugzilla/BugUrl/MozSupport.pm20
-rw-r--r--Bugzilla/BugUrl/ServiceNow.pm12
-rw-r--r--Bugzilla/BugUrl/SourceForge.pm43
-rw-r--r--Bugzilla/BugUrl/Splat.pm12
-rw-r--r--Bugzilla/BugUrl/Trac.pm25
-rw-r--r--Bugzilla/BugUrl/WebCompat.pm24
17 files changed, 311 insertions, 296 deletions
diff --git a/Bugzilla/BugUrl/Aha.pm b/Bugzilla/BugUrl/Aha.pm
index b467c54d8..cc733ae13 100644
--- a/Bugzilla/BugUrl/Aha.pm
+++ b/Bugzilla/BugUrl/Aha.pm
@@ -18,28 +18,28 @@ use base qw(Bugzilla::BugUrl);
###############################
sub should_handle {
- my ($class, $uri) = @_;
+ my ($class, $uri) = @_;
- return $uri =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!;
+ return $uri =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!;
}
sub get_feature_id {
- my ($self) = @_;
+ my ($self) = @_;
- if ($self->{value} =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!) {
- return $1;
- }
+ if ($self->{value} =~ m!^https?://[^.]+\.aha\.io/features/(\w+-\d+)!) {
+ return $1;
+ }
}
sub _check_value {
- my ($class, $uri) = @_;
+ my ($class, $uri) = @_;
- $uri = $class->SUPER::_check_value($uri);
+ $uri = $class->SUPER::_check_value($uri);
- # Aha HTTP URLs redirect to HTTPS, so just use the HTTPS scheme.
- $uri->scheme('https');
+ # Aha HTTP URLs redirect to HTTPS, so just use the HTTPS scheme.
+ $uri->scheme('https');
- return $uri;
+ return $uri;
}
1;
diff --git a/Bugzilla/BugUrl/Bugzilla.pm b/Bugzilla/BugUrl/Bugzilla.pm
index 3af6d0a54..1cedb1f56 100644
--- a/Bugzilla/BugUrl/Bugzilla.pm
+++ b/Bugzilla/BugUrl/Bugzilla.pm
@@ -21,37 +21,39 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->path =~ /show_bug\.cgi$/) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->path =~ /show_bug\.cgi$/) ? 1 : 0;
}
sub _check_value {
- my ($class, $uri) = @_;
-
- $uri = $class->SUPER::_check_value($uri);
-
- my $bug_id = $uri->query_param('id');
- # We don't currently allow aliases, because we can't check to see
- # if somebody's putting both an alias link and a numeric ID link.
- # When we start validating the URL by accessing the other Bugzilla,
- # we can allow aliases.
- detaint_natural($bug_id);
- if (!$bug_id) {
- my $value = $uri->as_string;
- ThrowUserError('bug_url_invalid', { url => $value, reason => 'id' });
- }
-
- # Make sure that "id" is the only query parameter.
- $uri->query("id=$bug_id");
- # And remove any # part if there is one.
- $uri->fragment(undef);
-
- return $uri;
+ my ($class, $uri) = @_;
+
+ $uri = $class->SUPER::_check_value($uri);
+
+ my $bug_id = $uri->query_param('id');
+
+ # We don't currently allow aliases, because we can't check to see
+ # if somebody's putting both an alias link and a numeric ID link.
+ # When we start validating the URL by accessing the other Bugzilla,
+ # we can allow aliases.
+ detaint_natural($bug_id);
+ if (!$bug_id) {
+ my $value = $uri->as_string;
+ ThrowUserError('bug_url_invalid', {url => $value, reason => 'id'});
+ }
+
+ # Make sure that "id" is the only query parameter.
+ $uri->query("id=$bug_id");
+
+ # And remove any # part if there is one.
+ $uri->fragment(undef);
+
+ return $uri;
}
sub target_bug_id {
- my ($self) = @_;
- return new URI($self->name)->query_param('id');
+ my ($self) = @_;
+ return new URI($self->name)->query_param('id');
}
1;
diff --git a/Bugzilla/BugUrl/Bugzilla/Local.pm b/Bugzilla/BugUrl/Bugzilla/Local.pm
index 14d03f048..73086524e 100644
--- a/Bugzilla/BugUrl/Bugzilla/Local.pm
+++ b/Bugzilla/BugUrl/Bugzilla/Local.pm
@@ -20,83 +20,80 @@ use Bugzilla::Util;
#### Initialization ####
###############################
-use constant VALIDATOR_DEPENDENCIES => {
- value => ['bug_id'],
-};
+use constant VALIDATOR_DEPENDENCIES => {value => ['bug_id'],};
###############################
#### Methods ####
###############################
sub ref_bug_url {
- my $self = shift;
-
- if (!exists $self->{ref_bug_url}) {
- my $ref_bug_id = new URI($self->name)->query_param('id');
- my $ref_bug = Bugzilla::Bug->check($ref_bug_id);
- my $ref_value = $self->local_uri($self->bug_id);
- $self->{ref_bug_url} =
- new Bugzilla::BugUrl::Bugzilla::Local({ bug_id => $ref_bug->id,
- value => $ref_value });
- }
- return $self->{ref_bug_url};
+ my $self = shift;
+
+ if (!exists $self->{ref_bug_url}) {
+ my $ref_bug_id = new URI($self->name)->query_param('id');
+ my $ref_bug = Bugzilla::Bug->check($ref_bug_id);
+ my $ref_value = $self->local_uri($self->bug_id);
+ $self->{ref_bug_url} = new Bugzilla::BugUrl::Bugzilla::Local(
+ {bug_id => $ref_bug->id, value => $ref_value});
+ }
+ return $self->{ref_bug_url};
}
sub should_handle {
- my ($class, $uri) = @_;
-
- # 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);
- }
-
- return 0;
+ my ($class, $uri) = @_;
+
+ # 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);
+ }
+
+ return 0;
}
sub _check_value {
- my ($class, $uri, undef, $params) = @_;
-
- # At this point we are going to treat any word as a
- # bug id/alias to the local Bugzilla.
- my $value = $uri->as_string;
- if ($value =~ m/^\w+$/) {
- $uri = new URI($class->local_uri($value));
- } else {
- # It's not a word, then we have to check
- # if it's a valid Bugzilla url.
- $uri = $class->SUPER::_check_value($uri);
- }
-
- my $ref_bug_id = $uri->query_param('id');
- my $ref_bug = Bugzilla::Bug->check($ref_bug_id);
- my $self_bug_id = $params->{bug_id};
- $params->{ref_bug} = $ref_bug;
-
- if ($ref_bug->id == $self_bug_id) {
- ThrowUserError('see_also_self_reference');
- }
-
- my $product = $ref_bug->product_obj;
- if (!Bugzilla->user->can_edit_product($product->id)) {
- ThrowUserError("product_edit_denied",
- { product => $product->name });
- }
-
- return $uri;
+ my ($class, $uri, undef, $params) = @_;
+
+ # At this point we are going to treat any word as a
+ # bug id/alias to the local Bugzilla.
+ my $value = $uri->as_string;
+ if ($value =~ m/^\w+$/) {
+ $uri = new URI($class->local_uri($value));
+ }
+ else {
+ # It's not a word, then we have to check
+ # if it's a valid Bugzilla url.
+ $uri = $class->SUPER::_check_value($uri);
+ }
+
+ my $ref_bug_id = $uri->query_param('id');
+ my $ref_bug = Bugzilla::Bug->check($ref_bug_id);
+ my $self_bug_id = $params->{bug_id};
+ $params->{ref_bug} = $ref_bug;
+
+ if ($ref_bug->id == $self_bug_id) {
+ ThrowUserError('see_also_self_reference');
+ }
+
+ my $product = $ref_bug->product_obj;
+ if (!Bugzilla->user->can_edit_product($product->id)) {
+ ThrowUserError("product_edit_denied", {product => $product->name});
+ }
+
+ return $uri;
}
sub local_uri {
- my ($self, $bug_id) = @_;
- $bug_id ||= '';
- return Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$bug_id";
+ my ($self, $bug_id) = @_;
+ $bug_id ||= '';
+ return Bugzilla->localconfig->{urlbase} . "show_bug.cgi?id=$bug_id";
}
1;
diff --git a/Bugzilla/BugUrl/Chromium.pm b/Bugzilla/BugUrl/Chromium.pm
index 5560df24c..2d4fcd178 100644
--- a/Bugzilla/BugUrl/Chromium.pm
+++ b/Bugzilla/BugUrl/Chromium.pm
@@ -21,29 +21,30 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->authority =~ /^bugs.chromium.org$/i) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->authority =~ /^bugs.chromium.org$/i) ? 1 : 0;
}
sub _check_value {
- my ($class, $uri) = @_;
-
- $uri = $class->SUPER::_check_value($uri);
-
- my $value = $uri->as_string;
- my $project_name;
- if ($uri->path =~ m|^/p/([^/]+)/issues/detail$|) {
- $project_name = $1;
- } else {
- ThrowUserError('bug_url_invalid', { url => $value });
- }
- my $bug_id = $uri->query_param('id');
- detaint_natural($bug_id);
- if (!$bug_id) {
- ThrowUserError('bug_url_invalid', { url => $value, reason => 'id' });
- }
-
- return URI->new($value);
+ my ($class, $uri) = @_;
+
+ $uri = $class->SUPER::_check_value($uri);
+
+ my $value = $uri->as_string;
+ my $project_name;
+ if ($uri->path =~ m|^/p/([^/]+)/issues/detail$|) {
+ $project_name = $1;
+ }
+ else {
+ ThrowUserError('bug_url_invalid', {url => $value});
+ }
+ my $bug_id = $uri->query_param('id');
+ detaint_natural($bug_id);
+ if (!$bug_id) {
+ ThrowUserError('bug_url_invalid', {url => $value, reason => 'id'});
+ }
+
+ return URI->new($value);
}
1;
diff --git a/Bugzilla/BugUrl/Debian.pm b/Bugzilla/BugUrl/Debian.pm
index e018c1106..88b808382 100644
--- a/Bugzilla/BugUrl/Debian.pm
+++ b/Bugzilla/BugUrl/Debian.pm
@@ -20,33 +20,33 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->authority =~ /^bugs.debian.org$/i) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->authority =~ /^bugs.debian.org$/i) ? 1 : 0;
}
sub _check_value {
- my $class = shift;
-
- my $uri = $class->SUPER::_check_value(@_);
-
- # Debian BTS URLs can look like various things:
- # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1234
- # http://bugs.debian.org/1234
- my $bug_id;
- if ($uri->path =~ m|^/(\d+)$|) {
- $bug_id = $1;
- }
- elsif ($uri->path =~ /bugreport\.cgi$/) {
- $bug_id = $uri->query_param('bug');
- detaint_natural($bug_id);
- }
- if (!$bug_id) {
- ThrowUserError('bug_url_invalid',
- { url => $uri->path, reason => 'id' });
- }
- # This is the shortest standard URL form for Debian BTS URLs,
- # and so we reduce all URLs to this.
- return new URI("http://bugs.debian.org/" . $bug_id);
+ my $class = shift;
+
+ my $uri = $class->SUPER::_check_value(@_);
+
+ # Debian BTS URLs can look like various things:
+ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1234
+ # http://bugs.debian.org/1234
+ my $bug_id;
+ if ($uri->path =~ m|^/(\d+)$|) {
+ $bug_id = $1;
+ }
+ elsif ($uri->path =~ /bugreport\.cgi$/) {
+ $bug_id = $uri->query_param('bug');
+ detaint_natural($bug_id);
+ }
+ if (!$bug_id) {
+ ThrowUserError('bug_url_invalid', {url => $uri->path, reason => 'id'});
+ }
+
+ # This is the shortest standard URL form for Debian BTS URLs,
+ # and so we reduce all URLs to this.
+ return new URI("http://bugs.debian.org/" . $bug_id);
}
1;
diff --git a/Bugzilla/BugUrl/Edge.pm b/Bugzilla/BugUrl/Edge.pm
index 95d24c93a..53145dda9 100644
--- a/Bugzilla/BugUrl/Edge.pm
+++ b/Bugzilla/BugUrl/Edge.pm
@@ -26,19 +26,21 @@ use List::MoreUtils qw( any );
# https://wpdev.uservoice.com/forums/257854/suggestions/17420707
# https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/17420707-implement-css-display-flow-root-modern-clearfi
sub should_handle {
- my ($class, $uri) = @_;
- return any { lc($uri->authority) eq $_ } qw( developer.microsoft.com wpdev.uservoice.com );
+ my ($class, $uri) = @_;
+ return any { lc($uri->authority) eq $_ }
+ qw( developer.microsoft.com wpdev.uservoice.com );
}
sub _check_value {
- my ($class, $uri) = @_;
+ my ($class, $uri) = @_;
- $uri = $class->SUPER::_check_value($uri);
+ $uri = $class->SUPER::_check_value($uri);
- return $uri if $uri->path =~ m{^/en-us/microsoft-edge/platform/issues/\d+/$};
- return $uri if $uri->path =~ m{^/forums/\d+(?:-[^/]+)?/suggestions/\d+(?:-[^/]+)?};
+ return $uri if $uri->path =~ m{^/en-us/microsoft-edge/platform/issues/\d+/$};
+ return $uri
+ if $uri->path =~ m{^/forums/\d+(?:-[^/]+)?/suggestions/\d+(?:-[^/]+)?};
- ThrowUserError('bug_url_invalid', { url => "$uri" });
+ ThrowUserError('bug_url_invalid', {url => "$uri"});
}
1;
diff --git a/Bugzilla/BugUrl/GitHub.pm b/Bugzilla/BugUrl/GitHub.pm
index 1a0219617..a81564812 100644
--- a/Bugzilla/BugUrl/GitHub.pm
+++ b/Bugzilla/BugUrl/GitHub.pm
@@ -18,25 +18,25 @@ use base qw(Bugzilla::BugUrl);
###############################
sub should_handle {
- my ($class, $uri) = @_;
-
- # GitHub issue URLs have only one form:
- # https://github.com/USER_OR_TEAM_OR_ORGANIZATION_NAME/REPOSITORY_NAME/issues/111
- # GitHub pull request URLs have only one form:
- # https://github.com/USER_OR_TEAM_OR_ORGANIZATION_NAME/REPOSITORY_NAME/pull/111
- return (lc($uri->authority) eq 'github.com'
- and $uri->path =~ m!^/[^/]+/[^/]+/(?:issues|pull)/\d+$!) ? 1 : 0;
+ my ($class, $uri) = @_;
+
+# GitHub issue URLs have only one form:
+# https://github.com/USER_OR_TEAM_OR_ORGANIZATION_NAME/REPOSITORY_NAME/issues/111
+# GitHub pull request URLs have only one form:
+# https://github.com/USER_OR_TEAM_OR_ORGANIZATION_NAME/REPOSITORY_NAME/pull/111
+ return (lc($uri->authority) eq 'github.com'
+ and $uri->path =~ m!^/[^/]+/[^/]+/(?:issues|pull)/\d+$!) ? 1 : 0;
}
sub _check_value {
- my ($class, $uri) = @_;
+ my ($class, $uri) = @_;
- $uri = $class->SUPER::_check_value($uri);
+ $uri = $class->SUPER::_check_value($uri);
- # GitHub HTTP URLs redirect to HTTPS, so just use the HTTPS scheme.
- $uri->scheme('https');
+ # GitHub HTTP URLs redirect to HTTPS, so just use the HTTPS scheme.
+ $uri->scheme('https');
- return $uri;
+ return $uri;
}
1;
diff --git a/Bugzilla/BugUrl/Google.pm b/Bugzilla/BugUrl/Google.pm
index 6c8a2f27d..d36f4eb62 100644
--- a/Bugzilla/BugUrl/Google.pm
+++ b/Bugzilla/BugUrl/Google.pm
@@ -20,35 +20,41 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->authority =~ /^code.google.com$/i) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->authority =~ /^code.google.com$/i) ? 1 : 0;
}
sub _check_value {
- my ($class, $uri) = @_;
-
- $uri = $class->SUPER::_check_value($uri);
-
- my $value = $uri->as_string;
- # Google Code URLs only have one form:
- # http(s)://code.google.com/p/PROJECT_NAME/issues/detail?id=1234
- my $project_name;
- if ($uri->path =~ m|^/p/([^/]+)/issues/detail$|) {
- $project_name = $1;
- } else {
- ThrowUserError('bug_url_invalid', { url => $value });
- }
- my $bug_id = $uri->query_param('id');
- detaint_natural($bug_id);
- if (!$bug_id) {
- ThrowUserError('bug_url_invalid', { url => $value, reason => 'id' });
- }
- # While Google Code URLs can be either HTTP or HTTPS,
- # always go with the HTTP scheme, as that's the default.
- $value = "http://code.google.com/p/" . $project_name .
- "/issues/detail?id=" . $bug_id;
-
- return new URI($value);
+ my ($class, $uri) = @_;
+
+ $uri = $class->SUPER::_check_value($uri);
+
+ my $value = $uri->as_string;
+
+ # Google Code URLs only have one form:
+ # http(s)://code.google.com/p/PROJECT_NAME/issues/detail?id=1234
+ my $project_name;
+ if ($uri->path =~ m|^/p/([^/]+)/issues/detail$|) {
+ $project_name = $1;
+ }
+ else {
+ ThrowUserError('bug_url_invalid', {url => $value});
+ }
+ my $bug_id = $uri->query_param('id');
+ detaint_natural($bug_id);
+ if (!$bug_id) {
+ ThrowUserError('bug_url_invalid', {url => $value, reason => 'id'});
+ }
+
+ # While Google Code URLs can be either HTTP or HTTPS,
+ # always go with the HTTP scheme, as that's the default.
+ $value
+ = "http://code.google.com/p/"
+ . $project_name
+ . "/issues/detail?id="
+ . $bug_id;
+
+ return new URI($value);
}
1;
diff --git a/Bugzilla/BugUrl/JIRA.pm b/Bugzilla/BugUrl/JIRA.pm
index ba4b0e51b..a6cf75e93 100644
--- a/Bugzilla/BugUrl/JIRA.pm
+++ b/Bugzilla/BugUrl/JIRA.pm
@@ -20,25 +20,26 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->path =~ m|/browse/[A-Z][A-Z]+-\d+$|) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->path =~ m|/browse/[A-Z][A-Z]+-\d+$|) ? 1 : 0;
}
sub _check_value {
- my $class = shift;
+ my $class = shift;
- my $uri = $class->SUPER::_check_value(@_);
+ my $uri = $class->SUPER::_check_value(@_);
- # JIRA URLs have only one basic form (but the jira is optional):
- # https://issues.apache.org/jira/browse/KEY-1234
- # http://issues.example.com/browse/KEY-1234
+ # JIRA URLs have only one basic form (but the jira is optional):
+ # https://issues.apache.org/jira/browse/KEY-1234
+ # http://issues.example.com/browse/KEY-1234
- # 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/Bugzilla/BugUrl/Launchpad.pm b/Bugzilla/BugUrl/Launchpad.pm
index a56fed4ad..4b3bb3b0d 100644
--- a/Bugzilla/BugUrl/Launchpad.pm
+++ b/Bugzilla/BugUrl/Launchpad.pm
@@ -19,30 +19,32 @@ use Bugzilla::Error;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->authority =~ /launchpad.net$/) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->authority =~ /launchpad.net$/) ? 1 : 0;
}
sub _check_value {
- my ($class, $uri) = @_;
-
- $uri = $class->SUPER::_check_value($uri);
-
- my $value = $uri->as_string;
- # Launchpad bug URLs can look like various things:
- # https://bugs.launchpad.net/ubuntu/+bug/1234
- # https://launchpad.net/bugs/1234
- # All variations end with either "/bugs/1234" or "/+bug/1234"
- if ($uri->path =~ m|bugs?/(\d+)$|) {
- # This is the shortest standard URL form for Launchpad bugs,
- # and so we reduce all URLs to this.
- $value = "https://launchpad.net/bugs/$1";
- }
- else {
- ThrowUserError('bug_url_invalid', { url => $value, reason => 'id' });
- }
-
- return new URI($value);
+ my ($class, $uri) = @_;
+
+ $uri = $class->SUPER::_check_value($uri);
+
+ my $value = $uri->as_string;
+
+ # Launchpad bug URLs can look like various things:
+ # https://bugs.launchpad.net/ubuntu/+bug/1234
+ # https://launchpad.net/bugs/1234
+ # All variations end with either "/bugs/1234" or "/+bug/1234"
+ if ($uri->path =~ m|bugs?/(\d+)$|) {
+
+ # This is the shortest standard URL form for Launchpad bugs,
+ # and so we reduce all URLs to this.
+ $value = "https://launchpad.net/bugs/$1";
+ }
+ else {
+ ThrowUserError('bug_url_invalid', {url => $value, reason => 'id'});
+ }
+
+ return new URI($value);
}
1;
diff --git a/Bugzilla/BugUrl/MantisBT.pm b/Bugzilla/BugUrl/MantisBT.pm
index 48284c7e0..9cf49cdb8 100644
--- a/Bugzilla/BugUrl/MantisBT.pm
+++ b/Bugzilla/BugUrl/MantisBT.pm
@@ -20,22 +20,22 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->path_query =~ m|view\.php\?id=\d+$|) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->path_query =~ m|view\.php\?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(@_);
- # MantisBT URLs look like the following ('bugs' directory is optional):
- # http://www.mantisbt.org/bugs/view.php?id=1234
+ # MantisBT URLs look like the following ('bugs' directory is optional):
+ # http://www.mantisbt.org/bugs/view.php?id=1234
- # Remove any # part if there is one.
- $uri->fragment(undef);
+ # Remove any # part if there is one.
+ $uri->fragment(undef);
- return $uri;
+ return $uri;
}
1;
diff --git a/Bugzilla/BugUrl/MozSupport.pm b/Bugzilla/BugUrl/MozSupport.pm
index c2442e4df..b924f3f53 100644
--- a/Bugzilla/BugUrl/MozSupport.pm
+++ b/Bugzilla/BugUrl/MozSupport.pm
@@ -18,23 +18,23 @@ use base qw(Bugzilla::BugUrl);
###############################
sub should_handle {
- my ($class, $uri) = @_;
+ my ($class, $uri) = @_;
- # Mozilla support questions normally have the form:
- # https://support.mozilla.org/<language>/questions/<id>
- return ($uri->authority =~ /^support.mozilla.org$/i
- and $uri->path =~ m|^(/[^/]+)?/questions/\d+$|) ? 1 : 0;
+ # Mozilla support questions normally have the form:
+ # https://support.mozilla.org/<language>/questions/<id>
+ return ($uri->authority =~ /^support.mozilla.org$/i
+ and $uri->path =~ m|^(/[^/]+)?/questions/\d+$|) ? 1 : 0;
}
sub _check_value {
- my ($class, $uri) = @_;
+ my ($class, $uri) = @_;
- $uri = $class->SUPER::_check_value($uri);
+ $uri = $class->SUPER::_check_value($uri);
- # Support.mozilla.org redirects to https automatically
- $uri->scheme('https');
+ # Support.mozilla.org redirects to https automatically
+ $uri->scheme('https');
- return $uri;
+ return $uri;
}
1;
diff --git a/Bugzilla/BugUrl/ServiceNow.pm b/Bugzilla/BugUrl/ServiceNow.pm
index 8e30aa45e..d65106a90 100644
--- a/Bugzilla/BugUrl/ServiceNow.pm
+++ b/Bugzilla/BugUrl/ServiceNow.pm
@@ -14,15 +14,15 @@ use warnings;
use base qw(Bugzilla::BugUrl);
sub should_handle {
- my ($class, $uri) = @_;
- return $uri =~ m#^https?://[^.]+\.service-now\.com/nav_to\.do\?#;
+ my ($class, $uri) = @_;
+ return $uri =~ m#^https?://[^.]+\.service-now\.com/nav_to\.do\?#;
}
sub _check_value {
- my ($class, $uri) = @_;
- $uri = $class->SUPER::_check_value($uri);
- $uri->scheme('https');
- return $uri;
+ my ($class, $uri) = @_;
+ $uri = $class->SUPER::_check_value($uri);
+ $uri->scheme('https');
+ return $uri;
}
1;
diff --git a/Bugzilla/BugUrl/SourceForge.pm b/Bugzilla/BugUrl/SourceForge.pm
index 3c8dfd51d..5e106880c 100644
--- a/Bugzilla/BugUrl/SourceForge.pm
+++ b/Bugzilla/BugUrl/SourceForge.pm
@@ -20,29 +20,32 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->authority =~ /^sourceforge.net$/i
- and $uri->path =~ m|/tracker/|) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->authority =~ /^sourceforge.net$/i and $uri->path =~ m|/tracker/|)
+ ? 1
+ : 0;
}
sub _check_value {
- my $class = shift;
-
- my $uri = $class->SUPER::_check_value(@_);
-
- # SourceForge tracker URLs have only one form:
- # http://sourceforge.net/tracker/?func=detail&aid=111&group_id=111&atid=111
- if ($uri->query_param('func') eq 'detail' and $uri->query_param('aid')
- and $uri->query_param('group_id') and $uri->query_param('atid'))
- {
- # Remove any # part if there is one.
- $uri->fragment(undef);
- return $uri;
- }
- else {
- my $value = $uri->as_string;
- ThrowUserError('bug_url_invalid', { url => $value });
- }
+ my $class = shift;
+
+ my $uri = $class->SUPER::_check_value(@_);
+
+ # SourceForge tracker URLs have only one form:
+ # http://sourceforge.net/tracker/?func=detail&aid=111&group_id=111&atid=111
+ if ( $uri->query_param('func') eq 'detail'
+ and $uri->query_param('aid')
+ and $uri->query_param('group_id')
+ and $uri->query_param('atid'))
+ {
+ # Remove any # part if there is one.
+ $uri->fragment(undef);
+ return $uri;
+ }
+ else {
+ my $value = $uri->as_string;
+ ThrowUserError('bug_url_invalid', {url => $value});
+ }
}
1;
diff --git a/Bugzilla/BugUrl/Splat.pm b/Bugzilla/BugUrl/Splat.pm
index 49b2b762f..da471f96d 100644
--- a/Bugzilla/BugUrl/Splat.pm
+++ b/Bugzilla/BugUrl/Splat.pm
@@ -14,15 +14,15 @@ use warnings;
use base qw(Bugzilla::BugUrl);
sub should_handle {
- my ($class, $uri) = @_;
- return $uri =~ m#^https?://hellosplat\.com/s/beanbag/tickets/\d+#;
+ my ($class, $uri) = @_;
+ return $uri =~ m#^https?://hellosplat\.com/s/beanbag/tickets/\d+#;
}
sub _check_value {
- my ($class, $uri) = @_;
- $uri = $class->SUPER::_check_value($uri);
- $uri->scheme('https'); # force https
- return $uri;
+ my ($class, $uri) = @_;
+ $uri = $class->SUPER::_check_value($uri);
+ $uri->scheme('https'); # force https
+ return $uri;
}
1;
diff --git a/Bugzilla/BugUrl/Trac.pm b/Bugzilla/BugUrl/Trac.pm
index 600b31105..61b1e99f2 100644
--- a/Bugzilla/BugUrl/Trac.pm
+++ b/Bugzilla/BugUrl/Trac.pm
@@ -20,25 +20,26 @@ use Bugzilla::Util;
###############################
sub should_handle {
- my ($class, $uri) = @_;
- return ($uri->path =~ m|/ticket/\d+$|) ? 1 : 0;
+ my ($class, $uri) = @_;
+ return ($uri->path =~ m|/ticket/\d+$|) ? 1 : 0;
}
sub _check_value {
- my $class = shift;
+ my $class = shift;
- my $uri = $class->SUPER::_check_value(@_);
+ my $uri = $class->SUPER::_check_value(@_);
- # Trac URLs can look like various things:
- # http://dev.mutt.org/trac/ticket/1234
- # http://trac.roundcube.net/ticket/1484130
+ # Trac URLs can look like various things:
+ # http://dev.mutt.org/trac/ticket/1234
+ # http://trac.roundcube.net/ticket/1484130
- # 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/Bugzilla/BugUrl/WebCompat.pm b/Bugzilla/BugUrl/WebCompat.pm
index bd66dcae7..0ee8fb638 100644
--- a/Bugzilla/BugUrl/WebCompat.pm
+++ b/Bugzilla/BugUrl/WebCompat.pm
@@ -18,22 +18,22 @@ use base qw(Bugzilla::BugUrl);
###############################
sub should_handle {
- my ($class, $uri) = @_;
+ my ($class, $uri) = @_;
- # https://webcompat.com/issues/1111
- my $host = lc($uri->authority);
- return
- ($host eq 'webcompat.com' || $host eq 'www.webcompat.com')
- && $uri->path =~ m#^/issues/\d+$#;
+ # https://webcompat.com/issues/1111
+ my $host = lc($uri->authority);
+ return ($host eq 'webcompat.com' || $host eq 'www.webcompat.com')
+ && $uri->path =~ m#^/issues/\d+$#;
}
sub _check_value {
- my ($class, $uri) = @_;
- $uri = $class->SUPER::_check_value($uri);
- # force https and drop www from host
- $uri->scheme('https');
- $uri->authority('webcompat.com');
- return $uri;
+ my ($class, $uri) = @_;
+ $uri = $class->SUPER::_check_value($uri);
+
+ # force https and drop www from host
+ $uri->scheme('https');
+ $uri->authority('webcompat.com');
+ return $uri;
}
1;