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.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | protected_node_field_collection_item-2623556.patch | 4.11 KB | stijnstroobants |
Comments
Comment #2
stijnstroobantsComment #3
grimreaperHello,
Thanks for the patch. Let's trigger the automated tests.
Please can you write an automated test for this use case with fieldcollections?
Comment #4
grimreaperHello,
Do you plan to write a patch with automated tests?
Comment #5
stijnstroobantsHi,
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?
Comment #6
grimreaperHello,
Ok, I will try to write the test for field_collection.
I have reproduced the bug and confirm that the patch fix it, thanks.
Comment #7
grimreaperDuring 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.
Comment #8
grimreaperOk 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.
Comment #10
grimreaperMerged.
Thanks.
Comment #11
grimreaperCrap, I can't reproduce the "show title" bug...
Comment #12
stijnstroobantsHi,
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.