diff options
author | Byron Jones <bjones@mozilla.com> | 2013-03-15 06:30:57 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2013-03-15 06:30:57 +0100 |
commit | 0131b54976afdd3662475e7e84ad66c2997c0287 (patch) | |
tree | b5c8bb7c808dba9c79931a04a39efc3757cb92fe /extensions/Splinter/lib | |
parent | d936a21ce97276c731abc6830a0ef3c0539e51e9 (diff) | |
download | bugzilla-0131b54976afdd3662475e7e84ad66c2997c0287.tar.gz bugzilla-0131b54976afdd3662475e7e84ad66c2997c0287.tar.xz |
Bug 850675: editing the splinter url always appends a /, which results in a broken url
Diffstat (limited to 'extensions/Splinter/lib')
-rw-r--r-- | extensions/Splinter/lib/Util.pm | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm index 9f09d3dcc..5258334a7 100644 --- a/extensions/Splinter/lib/Util.pm +++ b/extensions/Splinter/lib/Util.pm @@ -29,10 +29,11 @@ use Bugzilla::Util; use base qw(Exporter); @Bugzilla::Extension::Splinter::Util::EXPORT = qw( - attachment_is_visible + attachment_is_visible attachment_id_is_patch - get_review_url - get_review_link + get_review_base + get_review_url + get_review_link add_review_links_to_email ); @@ -80,23 +81,20 @@ sub attachment_id_is_patch { return ($attachment && $attachment->ispatch); } -sub get_review_url { - my ($bug, $attach_id, $absolute) = @_; +sub get_review_base { my $base = Bugzilla->params->{'splinter_base'}; - my $bug_id = $bug->id; - - if (defined $absolute && $absolute) { - my $urlbase = correct_urlbase(); - $urlbase =~ s!/$!! if $base =~ "^/"; - $base = $urlbase . $base; - } + $base =~ s!/$!!; + my $urlbase = correct_urlbase(); + $urlbase =~ s!/$!! if $base =~ "^/"; + $base = $urlbase . $base; + return $base; +} - if ($base =~ /\?/) { - return "$base&bug=$bug_id&attachment=$attach_id"; - } - else { - return "$base?bug=$bug_id&attachment=$attach_id"; - } +sub get_review_url { + my ($bug, $attach_id) = @_; + my $base = get_review_base(); + my $bug_id = $bug->id; + return $base . ($base =~ /\?/ ? '&' : '?') . "bug=$bug_id&attachment=$attach_id"; } sub get_review_link { |