From: Joey Hess Date: Tue, 26 Aug 2008 16:23:48 +0000 (-0400) Subject: Fixes creation of pages when clicking on WikiLinks starting with "/". X-Git-Tag: 2.53.1~24 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/af246e60c3b8f1dfb7e92435bad990641408d29f Fixes creation of pages when clicking on WikiLinks starting with "/". (cherry picked from commit 3879c56e71bb2e0d5fda81982d900fc93d4a893d) --- diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 99cead64f..b1a526aa8 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 142816b74..b6b9abe4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ ikiwiki (2.54) UNRELEASED; urgency=low with no whitespace. * ikiwiki-transition: Fix command-line processing so the prefix_directives transition works again. + * 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 deleted file mode 100644 index 11be2b7b7..000000000 --- a/doc/bugs/Can__39__t_create_root_page.mdwn +++ /dev/null @@ -1,7 +0,0 @@ -This is a link to a non-existent page in the root directory: [[/root_page_test]] (\[[/root\_page\_test]]) - -When you click on the question mark to create the page, you get *Error: bad page name*. It's a valid [[wikilink]], shouldn't it create the page? --[[sabr]] - -> Is it a valid wikilink? Should Iki prevent the page from being created? --[[sabr]], 2 months later - -This type of page name (with leading slash) also gets created by the aggregate plugin: /cgi-bin/ikiwiki.cgi?page=%2FCalculated_Risk&from=news%2FAll_Stories&do=create I'm now pretty convinced that Iki should handle this without error. I'll investigate if I can find the time.