#325198 by Amitaibu, Maximum upload size per node is never checked for unrequired...
authorDarrel O\'Pry
Sun, 16 Nov 2008 08:09:27 +0000 (08:09 +0000)
committerDarrel O\'Pry
Sun, 16 Nov 2008 08:09:27 +0000 (08:09 +0000)
good catch... thanks.

filefield_widget.inc

index db73405..e9f10f2 100644 (file)
@@ -331,7 +331,7 @@ function theme_filefield_widget_item($element) {
 function filefield_node_form_validate($form, &$form_state) {
   $type = content_types($form['type']['#value']);
   foreach ($type['fields'] as $field_name => $field) {
-    if (!(in_array($field['module'], array('imagefield', 'filefield'))) || !$field['required']) continue;
+    if (!(in_array($field['module'], array('imagefield', 'filefield')))) continue;
     $empty = $field['module'] .'_content_is_empty';
     $valid = false;
     $total_filesize = 0;
@@ -341,7 +341,7 @@ function filefield_node_form_validate($form, &$form_state) {
       $total_filesize += (int)$item['filesize'];
     }
 
-    if (!$valid) {
+    if (!$valid && $field['required']) {
       form_set_error($field_name, t('%title field is required.', array('%title' => $field['widget']['label'])));
     }
     $max_filesize = parse_size($field['widget']['max_filesize_per_node']);