Steps to reproduce:
- Create a node type with an image field with minimum dimensions of 300x500 pixels
- Create a new node of that type and attempt to upload an image which is smaller than 300x500 pixels
- Error message presented: "The specified file test.jpg could not be uploaded. The image is too small; the minimum dimensions are 300x500 pixels."
- Attempt to upload an image which is at least 300x500 pixels
Image is successfully uploaded and the error message is removed.
Image is successfully uploaded but the error message from the previous upload is still present.
From what I can tell the problem is in
file_ajax_upload() in file.module. The markup generated by
theme('status_messages') is prepended to the rendered form and ends up outside the form's ajax-wrapper div. When the form is submitted a second time only the ajax-wrapper div is replaced and the message is not removed.
The simplest way to get the status messages inside the ajax-wrapper is to replace line 238 of file.module:
$output = theme('status_messages') . drupal_render($form);
$form['#prefix'] .= theme('status_messages');
$output = drupal_render($form);
I verified that this change fixes the problem however I'm new enough to Drupal that someone else should look at this. There might be a better way to solve this or an edge case which is broken by this change.
PASSED: [[SimpleTest]]: [MySQL] 41,453 pass(es). View
|#25||Pics of result of patch testing.zip||107.83 KB||jessum|
PASSED: [[SimpleTest]]: [MySQL] 40,911 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] 56,053 pass(es), 3 fail(s), and 0 exception(s). View
PASSED: [[SimpleTest]]: [MySQL] 55,996 pass(es). View