Skip to content

Commit

Permalink
web: Fix hrefs when called without path_info
Browse files Browse the repository at this point in the history
If the cgi-scripts was references without path-info e.g.

    http://server/path/script

instead of

    http://server/path/script/

than wrong self-referencing urls are created, because the last path
component is replaces by the module ("/groups","/server" or "/active_jobs").

Reuse existings selfurl() function to generate the self-referencing
urls. This function replaces the path_info, not the last path component.
  • Loading branch information
donald committed Jan 29, 2020
1 parent 90b866e commit 9d625a2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions web/pages/mxq/mxq.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ sub HEAD {
return "<!DOCTYPE html><html>\n<head>\n".STYLE()."</head>\n";
}

sub selfurl {
my ($path_info)=@_;
return $q->url().$path_info;
}

sub my_url {
my ($module,$params)=@_;

my $uri=new URI($module,$q->url());
my $uri=new URI(selfurl("/$module"));
$uri->query_form($params,';');
return $uri;
}
Expand Down Expand Up @@ -862,11 +866,6 @@ sub server() {
return $out;
}

sub selfurl {
my ($path_info)=@_;
return $q->url().$path_info;
}

sub top_menu {
return '<table class="menu">' . $q->Tr(
$q->td(a({href=>selfurl('/groups')},'groups')),$q->td('&nbsp;'),
Expand Down

0 comments on commit 9d625a2

Please sign in to comment.