Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
file.module
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
5 Oct 2010 at 17:42 UTC
Updated:
20 Jul 2021 at 16:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
giorgoskbetter title
Comment #2
aaron commentedsubscribe
Comment #3
duellj commentedSimple fix. Field items were being rekeyed before loop to remove hidden items finished.
Comment #4
webchickNice catch.
Could we please add tests for this? We've found all kinds of these tweaky edge-case bugs in File.module lately, and I'd like to ensure we don't ever have to fix them twice. :)
Comment #5
duellj commentedIt looks like there was a test case to test the "display" option, but it only accounted for one file attached to a node. I'll rework the test so more than one file upload is tested. Do you think two will be enough?
Comment #6
giorgosk#3 fixes problem
Comment #7
duellj commentedHere's a reworking of the file field test to test multiple file fields (currently it's two, but could easily be changed to more). The only other thing I can see that needs to be tested is file order. It looks like there's a nice TODO message in field.test to add a test for display order, so maybe that can be handled in another issue.
Comment #8
dave reidMarked #1016068: File field display consecutive files hide error and #1041508: Problem with file_field_prepare_view as duplicates of this issue.
Confirmed this fixes a fairly major bug in D7 and the test looks like it covers it well.
Comment #9
webchickAwesome, thanks!
I committed #3 to HEAD for now so we can get the bug fixed, but some feedback on the test:
Ick! Can we not do this? Let's make separate variables for $nid and $type and use them accordingly. This change makes the test much harder to read and understand.
Comment #10
duellj commentedAgreed that $nid_or_type is just plain icky :). I was just referencing the call to FileFieldTestCase::uploadNodeFile, which takes $nid_or_type as an argument:
That function should also be rewritten, probably split out into two methods.
Comment #11
webchickWell, we unfortunately can't change that function signature in Drupal 7 without breaking other peoples' tests. However, we do have control over what the variables are named within the tests calling that function. So let's just revert the name change back to what it was before.
Comment #12
lolmaus commentedSo what's going to be done with this issue?
Comment #13
lolmaus commentedI've applied the #7 patch against Drupal 7.0 and it seems to resolve the issue.
Comment #15
markabur commentedGlad I found this. Client was extremely confused this morning. Patched 7.0 (using -p0) using #7 above and it works fine.
Comment #16
sunComment #17
donquixote commentedWorks ok for Drupal 7.
(I only tested the two lines in the foreach, not the test stuff)
Comment #18
mgiffordThis still a concern in D8? Unassigned issue too.
Comment #35
catchThe original bug was fixed back in 2011, and UploadNodeField, while it still exists, no longer has an $nid_or_file argument.