Defect scenario:
1. Image field with Plupload widget in a multiple mode
2. Save a node with several images in this field
3. On the edit form delete any image wihich is not the last one in a list (for example the first one)
4. Upload one or several images more
5. Save node
6. Go on the node page or edit form

Result: images are wrong. Different from what was uploaded and saved.

Reason: it happens because uploaded images delta is not calculated properly.

Please review this patch that fixes this issue.

Comments

Zheka’s picture

drupalina’s picture

(subscribing)
can someone please confirm if this patch solved this issue?
I will try to test it myself later.

sutharsan’s picture

Status: Needs review » Needs work

The patch fixes the problem. But I have a documentation issue with the patch.

+++ b/plup.jsundefined
@@ -52,6 +52,16 @@
                     // Nothing to do, just reminder of the presence for this event
+                    var maxDelta = 0;
+                    $(id +' .plup-list li').each(function(){
+                      fidInputName = $(this).find('input:first').attr('name');
+                      var nameParts = fidInputName.split('][');
+                      currentDelta = Number(nameParts[nameParts.length-2]);
+                      if(currentDelta>maxDelta) {
+                        maxDelta = currentDelta;
+                      }
+                    });
+                    plupInstance.max_delta = maxDelta;

This comment does no longer apply. The new code can use some comment though.

tame4tex’s picture

Patch fixes bug for me - drupal 7.22, plup 7.x-1.x-dev