aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/CGI.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-01-05 14:57:04 -0400
committerJoey Hess <joey@kitenet.net>2011-01-05 14:57:04 -0400
commit270cbd7cf52d95636da941799158dc000e4c2ffc (patch)
tree70f9091221bb15e8690d7bbae1f5c344a3eb626b /IkiWiki/CGI.pm
parent8c9c3915ecaf9cce4d0335f2b3c588d7f96d2b36 (diff)
downloadikiwiki-270cbd7cf52d95636da941799158dc000e4c2ffc.tar
ikiwiki-270cbd7cf52d95636da941799158dc000e4c2ffc.tar.gz
Fix redirect to use a full url.
Was broken (in theory) by baseurl changes in last release.
Diffstat (limited to 'IkiWiki/CGI.pm')
-rw-r--r--IkiWiki/CGI.pm18
1 files changed, 13 insertions, 5 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index df5179834..bdd190d4b 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -58,19 +58,27 @@ sub showform_preview ($$$$;@) {
my $cgi=shift;
my %params=@_;
- eval q{use URI};
- # The base url needs to be a full URL. If urlto returns relative,
- # force it absolute, using the same URL scheme used for the cgi.
- my $baseurl = URI->new_abs(urlto($params{page}), $cgi->url);
+ # The base url needs to be a full URL, and urlto may return a path.
+ my $baseurl = absurl(urlto($params{page}), $cgi->url);
showform($form, $buttons, $session, $cgi, @_,
forcebaseurl => $baseurl);
}
+# Forces a partial url (path only) to absolute, using the same
+# URL scheme as the CGI. Full URLs are left unchanged.
+sub absurl ($$) {
+ my $partialurl=shift;
+ my $q=shift;
+
+ eval q{use URI};
+ return URI->new_abs($partialurl, $q);
+}
+
sub redirect ($$) {
my $q=shift;
eval q{use URI};
- my $url=URI->new(shift);
+ my $url=URI->new(absurl(shift, $q));
if (! $config{w3mmode}) {
print $q->redirect($url);
}