Problem/Motivation
I am trying to give editors the ability to refresh remote video metadata (including thumbnails) when using the Video Embed Field module.
I applied the patch from Drupal core issue:
https://www.drupal.org/project/drupal/issues/2983456
This exposes the "Update metadata" functionality for media entities. However, even after updating metadata, the thumbnail image is not replaced.
The problem is not with Vimeo or oEmbed — the JSON endpoint returns the correct, updated thumbnail URL.
After clicking "Update metadata", the thumbnail file stored locally at:
public://video_thumbnails/{video_id}.jpgremains unchanged.
The issue appears to be that the existing thumbnail file is not replaced when it already exists locally. Since Vimeo uses a stable filename based on the video ID, the filename does not change, and the file system does not overwrite the existing file.
As a result, editors cannot refresh thumbnails even though the provider returns updated metadata.
Steps to reproduce
- Create a Remote Video media item using Video Embed Field (e.g., Vimeo).
- Confirm that the thumbnail is downloaded locally to:
public://video_thumbnails/{video_id}.jpg - Change the thumbnail in Vimeo.
- Verify that the Vimeo oEmbed endpoint returns the updated
thumbnail_url. - Click "Update metadata" in Drupal.
- Observe that the local thumbnail file is not replaced and the old thumbnail remains visible.
Proposed resolution
When updating metadata, the thumbnail download process should replace the existing file if the remote thumbnail URL has changed.
This can be achieved by using:
use Drupal\Core\File\FileExists; $this->fileSystem->saveData( $data, $destination, FileExists::Replace );
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 3576577-allow_update_metadata_thumbnail-5.patch | 2.58 KB | carolpettirossi |
| Screenshare - 2026-03-02 12_33_06 PM.mp4 | 3.4 MB | carolpettirossi |
Issue fork video_embed_field-3576577
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 #2
carolpettirossi commentedI'm having issues with the fork, so I'm uploading the patch as old days.
Comment #3
mably commentedThanks for your path but it looks like it recreates the thumbnail file every times it is displayed.
It seems that the "if the remote thumbnail URL has changed" condition has not been implemented.
Comment #4
carolpettirossi commentedImplemented a check if the URL has changed using the state API. Also added image styles 'flush'.
Pending: dependency injection
Comment #5
carolpettirossi commented.
Comment #6
carolpettirossi commentedI was having issues with Vimeo caching so I added a timestamp to the URL. It seems to have solved it