From: Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Date: Sun, 21 Sep 2008 17:22:54 +0000 (+0100)
Subject: editpage: beautify redirection URLs, avoiding exposing the implementation detail... 
X-Git-Tag: 2.66~67^2~3
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/e73987b01da90374aaaba063e5a36ba61e90aa5f?ds=inline;hp=--cc

editpage: beautify redirection URLs, avoiding exposing the implementation detail that index.html exists
---

e73987b01da90374aaaba063e5a36ba61e90aa5f
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");
 		}
 	}