- create an article node, with an image in its 'Image' field, submit
- edit the node, hit the 'Remove' button next to the image : no effect
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | 737686-14-ajax-fapi-rebuild-fix-temp.patch | 2.34 KB | effulgentsia |
| #3 | file.patch | 821 bytes | haza |
| #2 | file.patch | 710 bytes | haza |
Comments
Comment #1
aspilicious commentedMaybe introduced by upgrading to jquery 1.4.2
Don't know if it existed before...
Comment #2
hazaSeems that we can't remove the image because hook_file_references() reports that the file is in use. (and Maybe it is, because we're actually use it in the node himself...) and on file.module, $element['#file']->status is been check if it's set to 1.
Setting the $force Boolean to "true" seems to make the trick (not sure if it is the best way...)
Patch attached
Comment #3
haza(Sorry, forget about last patch, here is another one)
I' pretty sure this is NOT the way to do that. but if that could help someone to track the bug.
Comment #4
yoroy commentedNeeds review status for bot
Comment #5
bleen commentedempty lines should not have any spaces
145 critical left. Go review some!
Comment #7
yched commentedre @Haza (hi there !) : Well, even if the file was already in use (which it is not in this case), it should at most prevent its actual deletion from the filesystem, but we should still be able to remove it from a given field in a given node.
Comment #8
zserno commentedI checked earlier alpha releases and it looks like this bug was introduced in version 7.0-alpha3. Alpha2 works fine.
Checking the differences between the two versions...
Comment #9
zserno commentedI did some debugging between alpha2 and alpha3. It turned out that there's no significant code change in file.module.
However I noticed that in line 258 of file.module, variable $output has different value in alpha3.
As far as I understood, it should contain a piece of HTML that is supposed to replace image field's widget when remove button is clicked. Unfortunately this has exactly the same markup as the current widget (that shows the existing image and the remove button) instead of the new image upload stuff. That's why nothing changes...seemingly.
So we need to dig deeper in order to find out why drupal_render($form) returns this false result.
Comment #10
effulgentsia commentedThis is being worked on as part of #736298: Refactor file.module to use proper button click detection, enabling FAPI to improve button click detection security
Comment #11
zserno commented@effulgentsia Glad to hear that. Thanks :)
Comment #12
effulgentsia commentedEven ahead of the other issue, this one appears to be fixed now. If someone discovers otherwise, please set status back to "duplicate".
Comment #13
effulgentsia commentedNope. Still broken, but only with JS enabled. Works fine with JS disabled. #736298: Refactor file.module to use proper button click detection, enabling FAPI to improve button click detection security fixes it, but needs a test added to keep it fixed.
Comment #14
effulgentsia commented#736298: Refactor file.module to use proper button click detection, enabling FAPI to improve button click detection security and #756762: AJAX should follow same rules for whether to call drupal_rebuild_form() as non-AJAX submissions both fix this bug, and each is a critical issue, but they're large patches needing thorough review and will take time to move through the process, especially with people about to be busy with DrupalCon. In the meantime, we don't want this bug getting in the way of people working with Drupal 7, so here's a small patch that fixes it. It's basically how #756762: AJAX should follow same rules for whether to call drupal_rebuild_form() as non-AJAX submissions started before becoming a more ambitious and nicer cleanup of the underlying issue. My vote is for this patch to go in without new tests added, because I want to take some time improving the AJAX test coverage in file.module as part of #736298: Refactor file.module to use proper button click detection, enabling FAPI to improve button click detection security, but won't be able to get to that probably until after DrupalCon.
Comment #15
sunNot sure whether we have time for stop-gap fixes. I'd suggest to fix it properly via the other issues/patches.
Comment #16
Bojhan commentedAgreed, lets fix it the right way.
Comment #17
Alexander Matveev commentedproblem still exists
subscribing
Comment #18
Medom commentedsubscribing
Comment #19
Alexander Matveev commentedThe problem gone when I disabled jquery_update module.
Comment #20
acoustika commentedsubscribing
Comment #21
Anonymous (not verified) commentedDitto on the jQuery update part. I'll make do with the core jQuery until 7.1!
Comment #22
effulgentsia commentedjQuery 1.5 is not backwards compatible with jQuery 1.4, so will not be included in Drupal 7.1, or likely any version of Drupal prior to 8.0. It is the responsibility of the jQuery Update module to include JavaScript to fix breakages it introduces. For the file upload/remove breakage, that's being worked on in #1064890: Update jQuery Form to 2.64.