Exception thrown when trying to render a remote video field

Created on 20 September 2023, about 1 year ago
Updated 15 November 2023, about 1 year ago

Problem/Motivation

I'm getting an InvalidArgumentException when trying to render a remote video media through a media reference field. Here's the full error line:

InvalidArgumentException: The internal path component 'https://drupal10.ddev.site/media/oembed' is invalid. Its path component must have a leading slash, e.g. internal:/foo. in Drupal\Core\Url::fromInternalUri() (line 416 of core/lib/Drupal/Core/Url.php).

Steps to reproduce

1. Spin up a fresh Drupal 10 install with the Standard profile
2. Enable Media module
3. Install and enable Media oEmbed Control
4. Add a Media reference field to some content type (Article, for example), and check Remote Video as target
5. Make sure the reference field is using the "Rendered entity" formatter (view mode: default)
6. Make sure the "Video URL" field on Remote Video display settings is using the "oEmbed content" formatter
7. Create a Remote Video media content
8. Create an article content referencing the existing remote video
9. Access the article page

Proposed resolution

It seems the media_oembed_control_preprocess_field() function is expecting an internal path from the oEmbed formatter, but it's getting an absolute URL.

I'm trying to make a patch for this issue.

Remaining tasks

- Fix the InvalidArgumentException

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡§πŸ‡·Brazil gedvan JoΓ£o Pessoa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024