When a node with a multiple value file field contains items that are set to not be displayed, previewing changes to the node will remove all but the first undisplayed item from the field values.
Steps to reproduce in a fresh Drupal 7 installation:
- Add a file field to a content type.
- Set the number of values to unlimited.
- Enable Display field.
- Enable Files displayed by default.
- Log in as a regular user who can create content.
- Create a node and attach at least two files to the field. Save the node.
- Edit the node and uncheck the Display box for these files. (Or uncheck them when first creating the node. The result is the same.)
- Click Preview. All but the first of the file values will have disappeared from the list.
- If you save the node, it will save what the form says, so the other files will no longer be associated with the node (or at least the current revision.)
I suspect that this may be due to file_field_prepare_view() being called during the node preview, because that function simply removes non-displayed items from the entity. It might also be related to, but I haven't had a chance to look at the actual code, so I'm really just guessing at the reasons behind this.
Marking this bug as major because it's very easy for content editors to corrupt data simply by previewing their changes to a node.
PASSED: [[SimpleTest]]: [MySQL] 41,371 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 40,916 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] 41,099 pass(es), 1 fail(s), and 0 exception(s). View
PASSED: [[SimpleTest]]: [MySQL] 60,177 pass(es). View