plainblack.com
Username Password
search
Bookmark and Share
View All Tickets
Data Form deletes files on resave  (#3757)
Issue

When a DataForm entry is updated,  files that had previously been uploaded into file-type fields are deleted.


I found this bug on one of our production servers (WG version 7.3.22) and replicated it on a WebGUI stable demo site (WG version 7.4.34).

To replicate: 

  1. Create a DataForm with two fields: one text area type and one file type
  2. Commit your version.
  3. Add an entry in the DataForm by uploading a file into the file field and saving.
  4. Go to list all entries and click on the entryid to edit the entry.
  5. Change the text in the text area field (don't touch the file field).
  6. Save.
  7. Look at the entry again (via list) and see that the file is gone.
Solution Summary
Comments
mlamar
0
4/25/2008 2:36 pm


I believe I have found the problem in Form/File.pm.  In the function getValueFromPost, value was never getting set properly.  I replaced the line:

    my $value = $self->get("value");

with:

    my $value = "";
    $value = $self->session->form->param($self->get('name')) if ($self->session->request);

and now my files do not get deleted on a form entry update.  I hope this change does not break anything else that might use Form::File!  Patch file enclosed.

  -Michelle

Graham
0
5/7/2008 2:44 am

The patch as you've submitted it can't be used, as we don't want to trust a storage Id submitted by the user.  For existing storage locations, they have to be set to the previous value by the code using the form element.

Graham
0
6/12/2008 3:09 pm

7.5.11 fixes this bug as part of a rewrite of the DataForm.  A different solution will be needed for 7.4.

Vrby
0
6/13/2008 10:41 am

Testing to see if this fixed in 7.5.11

Vrby
0
6/13/2008 10:46 am

Verified fixed in 7.5.11

Details
Ticket Status Closed  
Rating0.0 
Submitted Bymlamar 
Date Submitted2008-04-24 
Assigned To unassigned  
Date Assigned2019-08-22 
Assigned By 
Severity Critical (mostly not working)  
What's the bug in? WebGUI Stable  
WebGUI / WRE Version 7.4.34  
URLbugs/tracker/data-form-deletes-files-on-resave
Keywords
Related Files
Ticket History
© 2019 Plain Black Corporation | All Rights Reserved