Closed (fixed)
Project:
File Entity (fieldable files)
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
16 Oct 2017 at 16:49 UTC
Updated:
30 Oct 2017 at 19:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
cboyden commentedAlso the checks are in the wrong order. If it's OK for the $file parameter to be a string, that should be checked first. Otherwise you'll get a PHP notice about "property of non-object" on the string. Is there anyplace where a string is passed into this function? It seems like the API allows it, but all the places where this hook is invoked seem to be passing in a file object.
Comment #3
cboyden commentedHere's a patch that fixes the property name and handles the check regardless of whether a string or an object is passed to the function. I added a check for a file object that didn't have a file ID but did have a type - which is the condition when you have a newly-uploaded file object that hasn't been saved as an entity yet - and it also seems to fix #2874781: allowed types, video files should include web files like vimeo and youtube.
Comment #4
cboyden commentedComment #5
joseph.olstadnice work. Patch looks good..
Comment #8
joseph.olstadComment #9
joseph.olstadmight want to add additional validation , check to make sure $cache_id is not empty before using it.