Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am using the field collection to group two file fields, I get an access denied message when I try to access the files. When I use the same field not grouped under field collection, I don't have a problem. Is this a known issue?
Comments
Comment #1
tim.plunkettThis isn't a known issue. Can you please elaborate on clearer steps to reproduce?
Comment #2
drupalnuts CreditAttribution: drupalnuts commentedI am using
field_collection, media, file_field and content_access.
I have a field collection item that has 3 fields, 1 of them is a file upload in the private file system.
It is attached to a node, that is accessible by all users (authenticated and anonymous )
When anonymous users try to download the file that is in the private file system, they get an access denied.
If I attach the field directly to the node entity, and bypass field_collection, it works correctly.
Comment #3
thisisjoe CreditAttribution: thisisjoe commentedExperiencing the same issue.
Using Content Access to control permissions for the node. The content type contains a field collection; the collection contains a file field, which is uploaded to a private folder.
Despite various configurations of the access control for the node, the file is not downloadable by anyone except for adminstrators or those with "[Node] Bypass content access control" enabled. The response is 403/"Access Denied". Log also adds "access denied" event.
Comment #4
yultyyev CreditAttribution: yultyyev commentedI have same troubles. It seems very strange. On my localhost with Drupal 7.22 I get 403 error when access private file with private file system (using field access) and get a file when field access value set to public. And on the server with Drupal 7.23 everytime when access to file (public field/private field and private file system) get 403 error.
Comment #5
BarisW CreditAttribution: BarisW at LimoenGroen commentedI think I found the problem; private files that are uploaded in a field collection should compare the file owner with the host entity owner, not with the file owner.
This fixes it for me: