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.
The FileValidationConstraintValidator might attempt to validate a file that does not exist. This happens for example when by a REST post you try to set an image reference "target_id" to one that does not exist.
Comment | File | Size | Author |
---|---|---|---|
#8 | interdiff.txt | 1.29 KB | Dinesh18 |
#8 | 2900675-8.patch | 1.29 KB | Dinesh18 |
validation-file_existance_check.patch | 1.05 KB | _Archy_ | |
Comments
Comment #2
_Archy_ CreditAttribution: _Archy_ at PitechPlus commentedComment #4
Wim LeersGreat catch! This still needs test coverage though: a failing test to show that the current code does not cover this edge case. Then applying your patch should make the test pass.
Comment #5
Wim LeersComment #6
Eric115 CreditAttribution: Eric115 at PreviousNext commentedI'm not a big fan of declaring variables in logic operators for use outside of block-scope. What do you think about something like this for readability?
Comment #7
borisson_Setting to needs work for the tests (#4), i also agree with #6.
Comment #8
Dinesh18 CreditAttribution: Dinesh18 as a volunteer commentedHere is an updated patch and interdiff as per comment #6.
Still needs tests.
Comment #10
MHGR CreditAttribution: MHGR commentedHi,
I have same issue, While updating User Picture using REST by PATCH method, I have try to set "target_id":xx,
but I have got response like
{
"message": "Unprocessable Entity: validation failed.\nuser_picture.0.target_id: This entity (file: xx) cannot be referenced.\n"
}
any one help in this.
Comment #11
MHGR CreditAttribution: MHGR commentedHi,
any one got solutions for this issue.
Comment #18
quietone CreditAttribution: quietone at PreviousNext commentedLooks like this was fixed in a later issue #2956814: FileValidationConstraintValidator assumes that the file exists.
Therefore, closing as a duplicate. If that is wrong, reopen the issue, by setting the status to 'Active', and add a comment.
Thanks!