aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-10 15:36:18 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-10 15:36:18 -0400
commit3879c56e71bb2e0d5fda81982d900fc93d4a893d (patch)
treed08415b11e0e63e2e52bef91d93b137a2ce97f5b
parentdcab5e2e48275dbeb3bf514c68826e73abed08bc (diff)
downloadikiwiki-3879c56e71bb2e0d5fda81982d900fc93d4a893d.tar
ikiwiki-3879c56e71bb2e0d5fda81982d900fc93d4a893d.tar.gz
Fixes creation of pages when clicking on WikiLinks starting with "/".
-rw-r--r--IkiWiki/CGI.pm6
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/Can__39__t_create_root_page.mdwn7
3 files changed, 12 insertions, 2 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 52d3474f5..2a847eb17 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -304,8 +304,9 @@ sub cgi_editpage ($$) { #{{{
# This untaint is safe because we check file_pruned.
my $page=$form->field('page');
$page=possibly_foolish_untaint($page);
+ my $absolute=($page =~ s#^/+##);
if (! defined $page || ! length $page ||
- file_pruned($page, $config{srcdir}) || $page=~/^\//) {
+ file_pruned($page, $config{srcdir})) {
error("bad page name");
}
@@ -424,7 +425,8 @@ sub cgi_editpage ($$) { #{{{
if (! defined $from || ! length $from ||
$from ne $form->field('from') ||
file_pruned($from, $config{srcdir}) ||
- $from=~/^\// ||
+ $from=~/^\// ||
+ $absolute ||
$form->submitted eq "Preview") {
@page_locs=$best_loc=$page;
}
diff --git a/debian/changelog b/debian/changelog
index 68c70f3f4..f1f002cf0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,7 @@ ikiwiki (2.54) UNRELEASED; urgency=low
[ Joey Hess ]
* template: Add support for a BASENAME variable.
+ * Fixes creation of pages when clicking on WikiLinks starting with "/".
-- Josh Triplett <josh@freedesktop.org> Wed, 09 Jul 2008 21:30:33 -0700
diff --git a/doc/bugs/Can__39__t_create_root_page.mdwn b/doc/bugs/Can__39__t_create_root_page.mdwn
index b56f3bddc..6d88dae6a 100644
--- a/doc/bugs/Can__39__t_create_root_page.mdwn
+++ b/doc/bugs/Can__39__t_create_root_page.mdwn
@@ -16,6 +16,9 @@ This type of page name (with leading slash) also gets created by the aggregate p
> <current>/subdir/subpage, when a user clicks the "?" link to create
> the missing page ; that's why I'm using absolute paths.
>
+>> Totally agree, this had only not been addressed due to lack of time on
+>> my part. (I have about 50 ikiwiki things on my todo list.) --[[Joey]]
+>
> Anyway, having the CGI consider invalid an otherwise valid wikilink
> seems a bit weird to me, so I had a look to the code, and here is a
> patch that should fix this issue ; I proceeded the only way I could
@@ -52,4 +55,8 @@ This type of page name (with leading slash) also gets created by the aggregate p
@page_locs=$best_loc=$page;
}
+
+> [[Applied|done]]. BTW, I also accept full git changesets, if you like
+> having your name in commit logs. :-)
+
[[tag patch]]