Hi,

files loaded in a field-collection are not password-protected if you directly visit them by using the absolute path.
I created a patch for this issue.

Also, in the original code, files are checked by filename-field in the file_managed table. If you upload a file with the same name, the filename will stay the same for both files. I changed the functionality that checks the uri.

Maybe there is a better solution for this, so please feel free to correct the patch.

Comments

StijnStroobants created an issue. See original summary.

stijnstroobants’s picture

Issue summary: View changes
StatusFileSize
new4.11 KB
grimreaper’s picture

Status: Active » Needs review

Hello,

Thanks for the patch. Let's trigger the automated tests.

Please can you write an automated test for this use case with fieldcollections?

grimreaper’s picture

Hello,

Do you plan to write a patch with automated tests?

stijnstroobants’s picture

Hi,
I'm sorry, but at the moment i don't have time to write some automated tests.

Maybe somebody else can find some spare-time to write it?

grimreaper’s picture

Hello,

Ok, I will try to write the test for field_collection.

I have reproduced the bug and confirm that the patch fix it, thanks.

grimreaper’s picture

Status: Needs review » Needs work
Related issues: +#2599248: array_filter() issue after upgrading to 7.x-1.0-beta10

During the writing of the test I ran into the following issue which is fixed but as there is no release with the patch. There are warnings in the tests.

#2599248: array_filter() issue after upgrading to 7.x-1.0-beta10

And I found a bug with show_title in _protected_node_save(). When there is not the checkbox there are cast and default value problems...

I am solving these.

Currently I have a problem of behavior. For example in the private files tests, in testAuthenticatedNonAllowedView(). I have a 403. And similarly with field collection I have the protected node password form.

grimreaper’s picture

Ok I find the problem with the expected 403. I have not well set up the private file field. It was public...

I have also modified your query to get all the field collection items it is be in (if you use media, you can use the same file multiple times).

I am running all the tests locally. If it is green. I wil commit and push.

I will open another issue for the "show title" problem.

  • Grimreaper committed 111cf8e on 7.x-1.x
    Issue #2623556 by Grimreaper: Fix coding standards.
    
  • Grimreaper committed 5ba17c2 on 7.x-1.x
    Issue #2623556 by Grimreaper: Add automated tests for field collection...
  • Grimreaper committed 6179b51 on 7.x-1.x authored by StijnStroobants
    Issue #2623556 by StijnStroobants, Grimreaper: No Field Collection...
grimreaper’s picture

Status: Needs work » Fixed

Merged.

Thanks.

grimreaper’s picture

Crap, I can't reproduce the "show title" bug...

stijnstroobants’s picture

Hi,
thanks for the commits!

Now I'm on holiday for a couple of weeks.
When I'm back home I will check all your commits.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.