Changing the list attribute or description of an uploaded file doesn't work. This is most likely related to the new forms API or node revision changes (or both). I'll attach a patch that fixes the list attribute problem, but the fix for description is more difficult.

In _upload_form(), description is in $form['current']['description'] which has the #tree attribute set to TRUE. The value of description is set within a foreach loop. The list and delete (called remove in the form) checkboxes are set outside that foreach loop. When the form from _upload_form() is returned to upload_from(), it's put into $form['attachments']. When the form is submitted, list and remove are $node['list'] and $node['remove'] whereas description is $node['attachments']['current']['description'].

Part of the bug is that upload_save() expects to access description as $file->description. That should be $node->description. However, with the forms the way they are, that won't work either.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Junyor’s picture

Status: Active » Needs work
FileSize
2.59 KB

Attaching partial patch that fixes the list attribute problem. This patch also makes preparations to fix the the description problem. I also fixed a logical error, which caused an UPDATE query to fire before it could be used.

Junyor’s picture

Status: Needs work » Needs review
FileSize
2.61 KB

Looks like someone fixed the tree problem. List and description now both work. :)

I've rerolled the patch to keep up with head.

Robin Monks’s picture

Looks good, +1

Robin

m3avrck’s picture

Status: Needs review » Reviewed & tested by the community

Patch looks good and works great here. Dries if you can commit this initial patch, we can start work on the description problem.

Also, this problem is related to (and even possibly a fix for): http://drupal.org/node/31102 ... need to get both of these resolved ASAP!

m3avrck’s picture

Patch looks good and works great here. Dries if you can commit this initial patch, we can start work on the description problem.

Also, this problem is related to (and even possibly a fix for): http://drupal.org/node/31102 ... need to get both of these resolved ASAP!

Junyor’s picture

This does fix the description problem.

moshe weitzman’s picture

seems like this is ready to go. any objection from CVS review team?

m3avrck’s picture

None here ;-) But yes, I really *need* this patch so we can fix other related problems, these problems are keeping a few of my sites from going live!

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Can you update the referenced issue, if that is taken care of now? Thanks.

m3avrck’s picture

Will do, we have a tangle of related file issues we are looking into :-)

Anonymous’s picture

Status: Fixed » Closed (fixed)