afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-07-25 01:52 pm

[dw-free] Text field larger than database field on sysban note field

[commit: http://hg.dwscoalition.org/dw-free/rev/152677ac5a33]

http://bugs.dwscoalition.org/show_bug.cgi?id=1472

Error message if > 255 characters.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/sysban.pl
--------------------------------------------------------------------------------
diff -r 8d2c494bf77a -r 152677ac5a33 cgi-bin/sysban.pl
--- a/cgi-bin/sysban.pl	Sat Jul 25 13:14:17 2009 +0000
+++ b/cgi-bin/sysban.pl	Sat Jul 25 13:51:36 2009 +0000
@@ -305,6 +305,12 @@ sub sysban_create {
             message => "Wrong arguments passed; should be a hash\n",
         }, 'ERROR';
     }
+    
+    if ( $opts{note} && length( $opts{note} ) > 255 ) {
+        return bless {
+            message => "Note too long; must be less than 256 characters\n",
+        }, 'ERROR';
+    }
 
 
     my $dbh = LJ::get_db_writer();
@@ -465,6 +471,12 @@ sub sysban_modify {
                         old expiry are required\n",
         }, 'ERROR';
     }
+    
+    if ( $opts{note} && length( $opts{note} ) > 255 ) {
+        return bless {
+            message => "Note too long; must be less than 256 characters\n",
+        }, 'ERROR';
+    }
 
     my $dbh = LJ::get_db_writer();
 
--------------------------------------------------------------------------------