Bug when adding new attachment
al.ex - July 24, 2007 - 14:28
| Project: | Attachment |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | al.ex |
| Status: | closed |
Jump to:
Description
There seems to be a bug when adding a new attachment within the edit node form. Every time a new attachment was added, the previous ones disappeared.
I could find the bug in attachment.module at line 158
if (($_POST['op'] == t('Preview')) || ($_POST['op'] == t('Submit'))) {
$node->attachments = $_POST['attachments'];
}the "op" POST-var comes from the node edit form submit-buttons (-> Preview, Submit). But if you click on "Add" for the new attachment, the submit-button's name-value is 'fileop' not 'op'. Hence you have to check for this POST-var too in order to keep the existing attachments.
if ($_POST['fileop'] == t('Add') || ($_POST['op'] == t('Preview')) || ($_POST['op'] == t('Submit'))) {
$node->attachments = $_POST['attachments'];
}Maybe someone more familiar to this module should also have a look at it.
Alex

#1
Alex,
Thanks again. Bug fixed and applied. I know why I missed the other bug, but I'm not sure how I didn't catch this one. Keep up the testing!
- Steve
#2