Form API/Node Revisions: List and description values aren't saved for uploaded files

Junyor - October 24, 2005 - 21:09
Project:Drupal
Component:upload.module
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

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.

#1

Junyor - October 25, 2005 - 06:04
Status:active» needs work

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.

AttachmentSize
drupal-head.junyor.upload.patch 2.59 KB

#2

Junyor - October 29, 2005 - 21:53
Status:needs work» needs review

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

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

AttachmentSize
drupal-head.junyor.upload2.patch 2.61 KB

#3

Robin Monks - November 1, 2005 - 23:52

Looks good, +1

Robin

#4

m3avrck - November 7, 2005 - 20:58
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!

#5

m3avrck - November 7, 2005 - 20:59

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!

#6

Junyor - November 7, 2005 - 23:06

This does fix the description problem.

#7

moshe weitzman - November 19, 2005 - 13:10

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

#8

m3avrck - November 21, 2005 - 15:24

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!

#9

Dries - November 21, 2005 - 15:37
Status:reviewed & tested by the community» fixed

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

#10

m3avrck - November 21, 2005 - 15:38

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

#11

Anonymous - December 5, 2005 - 15:40
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.