]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
reorder
authorJoey Hess <joey@kodama.kitenet.net>
Tue, 1 Jul 2008 17:22:11 +0000 (13:22 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Tue, 1 Jul 2008 17:22:11 +0000 (13:22 -0400)
canedit should fail first as it's a less expensive and harder to pass test

IkiWiki/Plugin/attachment.pm

index 8babe2be287067865f6253fb39fab1be590f4566..23862bc0587a2671c526cee602d8071dc4de1630 100644 (file)
@@ -54,6 +54,10 @@ sub formbuilder (@) { #{{{
                # The editpage code has already checked that
                # $form->field('page') is valid.
                $filename="XXX/$filename";
+
+               # Also check that the user is allowed to edit it by other
+               # policies.
+               IkiWiki::check_canedit($filename, $q, $params{session}, 1);
                
                # Use a pagespec to test that the attachment is valid.
                if (exists $config{valid_attachments} &&
@@ -65,10 +69,6 @@ sub formbuilder (@) { #{{{
                        }
                }
 
-               # Also check that the user is allowed to edit it by other
-               # policies.
-               IkiWiki::check_canedit($filename, $q, $params{session}, 1);
-
                # Move the attachment into place.
                # Try to use a fast rename; fall back to copying.
                prep_writefile($filename, $config{srcdir});