Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Bugzilla->urlbase method that returns a URI object #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Bugzilla.pm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use File::Spec::Functions;
use Safe;
use JSON::XS qw(decode_json);
use Scope::Guard;
use URI;

use parent qw(Bugzilla::CPAN);

Expand Down Expand Up @@ -162,6 +163,12 @@ sub localconfig {
||= Bugzilla::Localconfig->new(read_localconfig());
}

sub urlbase {
my ($class) = @_;

# Since this could be modified, we have to return a new one every time.
return URI->new($class->localconfig->{urlbase});
}

sub params {
return request_cache->{params} ||= Bugzilla::Config::read_param_file();
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/CGI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ sub send_cookie {
}

# Add the default path and the domain in.
state $uri = URI->new(Bugzilla->localconfig->urlbase);
state $uri = Bugzilla->urlbase;
$paramhash{'-path'} = $uri->path;

# we don't set the domain.
Expand Down
2 changes: 1 addition & 1 deletion Bugzilla/Template.pm
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ sub create {
'sudoer' => sub { return Bugzilla->sudoer; },

# Allow templates to access the "correct" URLBase value
'urlbase' => sub { return Bugzilla->localconfig->urlbase; },
'urlbase' => sub { Bugzilla->urlbase },

# Allow templates to get the absolute path of the URLBase value
'basepath' => sub { return Bugzilla->localconfig->basepath; },
Expand Down