Problem/Motivation
The module saves generated thumbnails in an incorrect directory.
Instead of being stored in the public files directory, thumbnails are saved in:
/web/:/video_thumbnails
Expected location:
/web/sites/default/files/video_thumbnails
Steps to reproduce
- Enable the module.
- Add a video embed field using the HTML5 provider.
- Enable display thumbnail.
- Check the generated thumbnail file location.
Actual result
Thumbnails are saved in an incorrect path (/web/:/video_thumbnails).
Expected result
Thumbnails should be saved in the public files directory (/web/sites/default/files/video_thumbnails) using Drupal's file system API.
Root cause
The issue is caused by the $thumbsDirectory property in Html5.php not being properly initialized.
It should be initialized using the parent implementation via the getThumbsDirectory() method.
Proposed solution
Initialize $thumbsDirectory using the parent getThumbsDirectory() method to ensure the correct Drupal file system path is used.
Issue fork video_embed_html5-3586425
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
witcher_ commentedComment #4
angel_devoeted commentedTested MR !13 in a Drupal 11 environment (Drupal Pod) and I can confirm it fixes the incorrect path issue.
Before the fix,
$thumbsDirectorywas uninitialized, but now it correctly points topublic://video_thumbnailsand thumbnails are generated as expected.The CI failure seems to be a false positive due to the environment's composer constraints and not the MR itself.
One minor concern: would it be safer to initialize this property in the constructor instead of the create method to ensure it's always set regardless of how the plugin is instantiated?
Comment #5
witcher_ commented@angel_devoeted, thanks for pointing this out. The initialization has been moved to the
__construct()method.A follow-up issue has been created to move all remaining variable initialization to the constructor.