Lets say your site allows revisions and you have a node with webfm attachments. If you revise your node (and submit it), then decide you need to revert the node to its previous state, all of the attachments are lost. They are actually deleted from the attach table.
Also, when you first enter a node with attachments, if you have a mandatory field on your node and you press submit without having completed the field (e.g the title) then all your attachments will be lost

Comments

geoff_eagles’s picture

The problem also exists in webfm for drupal 6.
The cure is to put a test in the 'update' section of webfm_nodeapi.
Before calling webfm_dbupdate_attach you need to compare the node->vid and node-old_vid - if there's a difference of more than 1 then they're reverting to an old revision so you shouldn't be running dbupdate.

stacysimpson’s picture

Version: 5.x-2.9 » 6.x-2.11

Do you have a patch for this issue?

nhck’s picture

Title: attachments get lost when you revert to a previous revision » Support revisions with Attachments
Version: 6.x-2.11 » 6.x-2.x-dev
Category: bug » feature
Priority: Normal » Major

geoff_eagles,

thank you for reporting this and helping to make webfm better. Actually I think this is an undefined behavior and also a feature request. It should be that we keep the vid as well to check which attachments belong to which revision.

Marking this as a feature request. For the other issue we have a "discusson" over here: #529074: Node preview restores detached file

Thank you very much.