From e73987b01da90374aaaba063e5a36ba61e90aa5f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 21 Sep 2008 18:22:54 +0100 Subject: editpage: beautify redirection URLs, avoiding exposing the implementation detail that index.html exists --- IkiWiki/Plugin/editpage.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm index bb21ed2be..e07052497 100644 --- a/IkiWiki/Plugin/editpage.pm +++ b/IkiWiki/Plugin/editpage.pm @@ -94,8 +94,8 @@ sub cgi_editpage ($$) { #{{{ error("bad page name"); } - my $baseurl=$config{url}."/".htmlpage($page); - + my $baseurl = urlto($page, undef, 1); + my $from; if (defined $form->field('from')) { ($from)=$form->field('from')=~/$config{wiki_file_regexp}/; @@ -152,13 +152,13 @@ sub cgi_editpage ($$) { #{{{ if ($form->submitted eq "Cancel") { if ($form->field("do") eq "create" && defined $from) { - redirect($q, "$config{url}/".htmlpage($from)); + redirect($q, urlto($from, undef, 1)); } elsif ($form->field("do") eq "create") { redirect($q, $config{url}); } else { - redirect($q, "$config{url}/".htmlpage($page)); + redirect($q, urlto($page, undef, 1)); } exit; } @@ -249,7 +249,7 @@ sub cgi_editpage ($$) { #{{{ @page_locs=$page; } else { - redirect($q, "$config{url}/".htmlpage($page)); + redirect($q, urlto($page, undef, 1)); exit; } } @@ -417,7 +417,7 @@ sub cgi_editpage ($$) { #{{{ else { # The trailing question mark tries to avoid broken # caches and get the most recent version of the page. - redirect($q, "$config{url}/".htmlpage($page)."?updated"); + redirect($q, urlto($page, undef, 1)."?updated"); } } -- cgit v1.2.3 From 97e3263ad11885c112767393cd6659c85810947a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 21 Sep 2008 18:23:33 +0100 Subject: poll: Use urlto to produce redirection URLs, avoiding mentions of index.html --- IkiWiki/Plugin/poll.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm index 35717c85f..84b02682e 100644 --- a/IkiWiki/Plugin/poll.pm +++ b/IkiWiki/Plugin/poll.pm @@ -102,7 +102,7 @@ sub sessioncgi ($$) { #{{{ my $oldchoice=$session->param($choice_param); if (defined $oldchoice && $oldchoice eq $choice) { # Same vote; no-op. - IkiWiki::redirect($cgi, "$config{url}/".htmlpage($page)); + IkiWiki::redirect($cgi, urlto($page, undef, 1); exit; } @@ -149,7 +149,7 @@ sub sessioncgi ($$) { #{{{ error($@) if $@; my $cookie = CGI::Cookie->new(-name=> $session->name, -value=> $session->id); print $cgi->redirect(-cookie => $cookie, - -url => "$config{url}/".htmlpage($page)); + -url => urlto($page, undef, 1)); exit; } } #}}} -- cgit v1.2.3 From 02923917c85a60aa5475c923606685a2acd36125 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 21 Sep 2008 18:24:51 +0100 Subject: recentchanges: construct redirections via urlto(), avoiding mentions of index.html --- IkiWiki/Plugin/recentchanges.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 7bc482974..dbb9065d4 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -103,7 +103,7 @@ sub cgi ($) { #{{{ "

"); } else { - IkiWiki::redirect($cgi, $config{url}.IkiWiki::beautify_urlpath("/".htmlpage($link))); + IkiWiki::redirect($cgi, urlto($link, undef, 1)); } exit; -- cgit v1.2.3 From 7f8259441058b16db1fd8dc2c6a53827a46794d8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 21 Sep 2008 18:25:06 +0100 Subject: remove: redirect via urlto(), avoiding mentions of index.html --- IkiWiki/Plugin/remove.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 9666408bc..b1cb6233d 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -207,7 +207,7 @@ sub sessioncgi ($$) { #{{{ if (! exists $pagesources{$parent}) { $parent="index"; } - IkiWiki::redirect($q, $config{url}."/".htmlpage($parent)); + IkiWiki::redirect($q, urlto($parent, '/', 1)); } } else { -- cgit v1.2.3