]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
close
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index 82b619592e1d9b916b0d9a1037df919edfe8502d..155010a97e6d606a1fff8af7b85ff93aef8fc0f5 100644 (file)
@@ -335,7 +335,8 @@ sub cgi_editpage ($$) { #{{{
        # characters.
        my ($page)=$form->field('page');
        $page=titlepage(possibly_foolish_untaint($page));
-       if (! defined $page || ! length $page || file_pruned($page, $config{srcdir}) || $page=~/^\//) {
+       if (! defined $page || ! length $page ||
+           file_pruned($page, $config{srcdir}) || $page=~/^\//) {
                error("bad page name");
        }
        
@@ -505,6 +506,7 @@ sub cgi_editpage ($$) { #{{{
                }
                
                showform($form, \@buttons, $session, $q);
+               saveindex();
        }
        else {
                # save page
@@ -512,8 +514,8 @@ sub cgi_editpage ($$) { #{{{
 
                my $exists=-e "$config{srcdir}/$file";
 
-               if ($form->field("do") ne "create" &&
-                   ! $exists && ! -e "$config{underlaydir}/$file") {
+               if ($form->field("do") ne "create" && ! $exists &&
+                   ! eval { srcfile($file) }) {
                        $form->tmpl_param("page_gone", 1);
                        $form->field(name => "do", value => "create", force => 1);
                        $form->tmpl_param("page_select", 0);