]> ruin.nu Git - ndwebbie.git/commitdiff
Only allow valid wiki page names
authorMichael Andreen <harv@ruin.nu>
Tue, 12 Aug 2008 17:20:23 +0000 (19:20 +0200)
committerMichael Andreen <harv@ruin.nu>
Tue, 12 Aug 2008 17:20:23 +0000 (19:20 +0200)
lib/NDWeb/Controller/Wiki.pm

index 1792fa1df22325adf5117211c9ef1da0644c1ef9..2bf03aa16eda20f4ca576e035a5f66d7487af5a7 100644 (file)
@@ -102,6 +102,9 @@ sub postedit : Local {
 
                my $wpid = $c->req->param('wpid');
                if ( $wpid eq 'new'){
+                       unless ($c->req->param('name') =~ /([A-Z]\w*)/){
+                               die 'The name is not valid, start with a capital letter and only use alphanumerical characters or _ for the rest';
+                       }
                        my $namespace = $dbh->selectrow_array(q{SELECT namespace
                                FROM wiki_namespace_access
                                WHERE namespace = $1 AND post AND gid IN (SELECT groups($2))