- Issue created by @cindytwilliams
- First commit to issue fork.
- Status changed to Postponed: needs info
over 1 year ago 7:22pm 3 January 2024 - πΊπΈUnited States Chris Burge
@cindytwilliams, can you double check the steps to reproduce? When I add a YouTube video, the media entity is created without error.
Here's the code in question:
/** * {@inheritdoc} * * Add timestamp query parameter to derivative images. */ public function buildUrl($path, $clean_urls = NULL) { $file_url = parent::buildUrl($path, $clean_urls); // Get the file object from its path. /** @var \Drupal\file\FileInterface[] $files */ $files = \Drupal::entityTypeManager() ->getStorage('file') ->loadByProperties(['uri' => $path]); /** @var \Drupal\file\FileInterface$file */ $file = reset($files); $changed = $file->getChangedTime(); $timestamp_query = _static_asset_cache_buster_get_cache_buster_query($changed); $file_url .= (strpos($file_url, '?') !== FALSE ? '&' : '?') . UrlHelper::buildQuery($timestamp_query); return $file_url; }
reset($files)
would returnFALSE
if->loadByProperties
returns an empty array, but that would only happen if the image file doesn't exist in the first place, which shouldn't be possible if code execution has made it this far.