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

Comments

cscsteve’s picture

Status: Needs review » Fixed

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

Anonymous’s picture

Status: Fixed » Closed (fixed)