From: Joey Hess Date: Thu, 10 Jul 2008 19:36:18 +0000 (-0400) Subject: Fixes creation of pages when clicking on WikiLinks starting with "/". X-Git-Tag: 2.54~158 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3879c56e71bb2e0d5fda81982d900fc93d4a893d;p=ikiwiki.git Fixes creation of pages when clicking on WikiLinks starting with "/". --- 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 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 > /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]]