GetSatisfaction.pm 1.02 KB
Newer Older
1 2 3 4 5 6 7 8
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

package Bugzilla::Extension::MoreBugUrl::GetSatisfaction;
9 10

use 5.10.1;
11
use strict;
12 13
use warnings;

14
use base qw(Bugzilla::BugUrl);
15 16 17 18 19 20

###############################
####        Methods        ####
###############################

sub should_handle {
21
  my ($class, $uri) = @_;
22

23 24 25 26
  # 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;
27 28 29
}

sub _check_value {
30
  my ($class, $uri) = @_;
31

32
  $uri = $class->SUPER::_check_value($uri);
33

34 35 36
  # GetSatisfaction HTTP URLs redirect to HTTPS, so just use the HTTPS
  # scheme.
  $uri->scheme('https');
37

38
  return $uri;
39 40 41
}

1;