]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
cherry-pick uri security fix
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index c8c1b63dd5c63d37b4e1854ed58a673920f296f5..4d4464c2872a48c32b331c88cfe4a35c9349a1fc 100644 (file)
@@ -357,6 +357,8 @@ sub cgi_editpage ($$) { #{{{
                        linkify($page, "",
                        preprocess($page, $page,
                        filter($page, $page, $content), 0, 1))));
+               # previewing may have created files on disk
+               saveindex();
        }
        elsif ($form->submitted eq "Save Page") {
                $form->tmpl_param("page_preview", "");
@@ -448,7 +450,6 @@ sub cgi_editpage ($$) { #{{{
                }
                
                showform($form, \@buttons, $session, $q);
-               saveindex();
        }
        else {
                # save page
@@ -526,7 +527,7 @@ sub cgi_editpage ($$) { #{{{
 
                        # Prevent deadlock with post-commit hook by
                        # signaling to it that it should not try to
-                       # do anything (except send commit mails).
+                       # do anything.
                        disable_commit_hook();
                        $conflict=rcs_commit($file, $message,
                                $form->field("rcsinfo"),
@@ -539,10 +540,6 @@ sub cgi_editpage ($$) { #{{{
                # may have been committed while the post-commit hook was
                # disabled.
                require IkiWiki::Render;
-               # Reload index, since the first time it's loaded is before
-               # the wiki is locked, and things may have changed in the
-               # meantime.
-               loadindex();
                refresh();
                saveindex();
 
@@ -616,6 +613,7 @@ sub cgi (;$$) { #{{{
        
        # Need to lock the wiki before getting a session.
        lockwiki();
+       loadindex();
        
        if (! $session) {
                $session=cgi_getsession($q);