]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
comments
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index 5aa744c9490eaae61c9549afcb0604c36f5e055b..07319ad22223da7261ee568ee1f46cbee3d394b7 100644 (file)
@@ -497,8 +497,11 @@ sub cgi_editpage ($$) { #{{{
        else {
                # save page
                check_canedit($page, $q, $session);
        else {
                # save page
                check_canedit($page, $q, $session);
-               if (! -e "$config{srcdir}/$file" &&
-                   $form->field("do") ne "create") {
+
+               my $exists=-e "$config{srcdir}/$file";
+
+               if ($form->field("do") ne "create" &&
+                   ! $exists && ! -e "$config{underlaydir}/$file") {
                        $form->tmpl_param("page_gone", 1);
                        $form->field(name => "do", value => "create", force => 1);
                        $form->tmpl_param("page_select", 0);
                        $form->tmpl_param("page_gone", 1);
                        $form->field(name => "do", value => "create", force => 1);
                        $form->tmpl_param("page_select", 0);
@@ -509,8 +512,7 @@ sub cgi_editpage ($$) { #{{{
                        print misctemplate($form->title, $form->render(submit => \@buttons));
                        return;
                }
                        print misctemplate($form->title, $form->render(submit => \@buttons));
                        return;
                }
-               elsif (-e "$config{srcdir}/$file" &&
-                      $form->field("do") eq "create") {
+               elsif ($form->field("do") eq "create" && $exists) {
                        $form->tmpl_param("creation_conflict", 1);
                        $form->field(name => "do", value => "edit", force => 1);
                        $form->tmpl_param("page_select", 0);
                        $form->tmpl_param("creation_conflict", 1);
                        $form->field(name => "do", value => "edit", force => 1);
                        $form->tmpl_param("page_select", 0);
@@ -557,7 +559,7 @@ sub cgi_editpage ($$) { #{{{
                                $message=$form->field('comments');
                        }
                        
                                $message=$form->field('comments');
                        }
                        
-                       if ($form->field("do") eq "create") {
+                       if (! $exists) {
                                rcs_add($file);
                        }
 
                                rcs_add($file);
                        }