Open philleepflorence opened 4 years ago
same problem, related https://github.com/directus/api/issues/1881 https://github.com/directus/api/issues/1904
@everyx ... this is the cause of the error for #1881 and #1904!
I fixed it on my end but wanted to be sure or find out what the fileId
is for.
Most likely, the issue is: Bad YouTube API Key
@philleepflorence Can you share your patch here, I want't patch it on my end :)
Line 377 has potential of error due to undefined array index. It should be like
$thumbnailData = $this->saveData($fileInfo['data'], $fileName, !empty($fileInfo['fileId']));
When trying to embed a Youtube URL
In the file and function:
Directus\Filesystem\Files->getLink()
, if you have a Youtube API Key that is not valid for any reason (domain mismatch, expired, et al) the function automatically tries to search for an image file which then throws a fatal error, as there is no file.Right now, the user will never know that the API key is failing or is invalid, but digging through the code, I noticed there is an exception thrown: Bad YouTube API Key, which should be shown to the Admin User, instead of bypassing and trying to locate a file.
Also, in the same file on line 377, there seems to be a mismatch or a property missing:
I cannot find any reference for
$fileInfo['fileId']
, and the third argument forpublic function saveData
expects a boolean.