fix for replacing from underlay
[ikiwiki.git] / IkiWiki / CGI.pm
index 6fd1f650665bf51461c65fe66a27c46d8e28fdd0..b47c8e8038d1c1d00a4d70b3c7349610e8702b19 100644 (file)
@@ -308,10 +308,12 @@ sub cgi_editpage ($$) { #{{{
        $page=lc($page);
        
        my $file=$page.$config{default_pageext};
-       my $newfile=1;
        if (exists $pagesources{lc($page)}) {
                $file=$pagesources{lc($page)};
-               $newfile=0;
+       }
+       my $newfile=0;
+       if (! -e "$config{srcdir}/$file") {
+               $newfile=1;
        }
 
        $form->field(name => "do", type => 'hidden');