]> sipb.mit.edu Git - ikiwiki.git/commitdiff
Fixes creation of pages when clicking on WikiLinks starting with "/".
authorJoey Hess <joey@kodama.kitenet.net>
Thu, 10 Jul 2008 19:36:18 +0000 (15:36 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Thu, 10 Jul 2008 19:36:18 +0000 (15:36 -0400)
IkiWiki/CGI.pm
debian/changelog
doc/bugs/Can__39__t_create_root_page.mdwn

index 52d3474f57d7cfefb2910341ea0cf96729ce756b..2a847eb1733ba275c31d4880d9f356fd847ec80a 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);
        # 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 ||
        if (! defined $page || ! length $page ||
-           file_pruned($page, $config{srcdir}) || $page=~/^\//) {
+           file_pruned($page, $config{srcdir})) {
                error("bad page name");
        }
 
                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}) ||
                        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;
                        }
                            $form->submitted eq "Preview") {
                                @page_locs=$best_loc=$page;
                        }
index 68c70f3f41de3ee0390c1bf2c49e5bd940bd9ee3..f1f002cf081f045873cb362390749c8254f96cef 100644 (file)
@@ -11,6 +11,7 @@ ikiwiki (2.54) UNRELEASED; urgency=low
 
   [ Joey Hess ]
   * template: Add support for a BASENAME variable.
 
   [ 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
 
 
  -- Josh Triplett <josh@freedesktop.org>  Wed, 09 Jul 2008 21:30:33 -0700
 
index b56f3bddc98f705d66355478e52e52045208122e..6d88dae6a9744f2fe60089ac7bf67d0ee95beaf8 100644 (file)
@@ -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.
 >
 > <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
 > 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;
                                }
 
                                        @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]]
 [[tag patch]]