]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Fixes creation of pages when clicking on WikiLinks starting with "/".
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 26 Aug 2008 16:23:48 +0000 (12:23 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 26 Aug 2008 16:23:48 +0000 (12:23 -0400)
(cherry picked from commit 3879c56e71bb2e0d5fda81982d900fc93d4a893d)

IkiWiki/CGI.pm
debian/changelog
doc/bugs/Can__39__t_create_root_page.mdwn [deleted file]

index 99cead64fcbbf5461820720c415f5eb91e8a58fc..b1a526aa823fcdf54650687e7d90cb929fb0d3ec 100644 (file)
@@ -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;
                        }
index 142816b7457d341b2ea1139bf55fb38ee3b1d906..b6b9abe4b583bf73d260697154b3706889efa471 100644 (file)
@@ -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 <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
deleted file mode 100644 (file)
index 11be2b7..0000000
+++ /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.