Problem/Motivation
In #3060550: oembed link does not pass the URL parameter to the provider Drupal started URL-decoding the oEmbed URL to work-around a Vimeo oEmbed issue.
However, query parameters should always be URL-encoded, because it's a URL and that's what you do, and also because the oEmbed spec at https://oembed.com/ documents this; see e.g. http://flickr.com/services/oembed?url=http%3A%2F%2Fflickr.com%2Fphotos%2Fbees%2F2362225867%2F&format=json
in the docs - the url
query parameter is URL-encoded.
The missing URL-encoding was breaking things for me because I'm dealing with some oEmbed URLs that have a fragment such as #123123 at the end of the URL; this needs to be URL-encoded when part of the url
query parameter or else it is interpreted as a fragment by guzzle HTTP client when sending the request (i.e. not sent as part of the request).
As documented at https://developer.vimeo.com/api/oembed/videos Vimeo has numerous query parameters which seem to be designed to be added directly to the oEmbed request itself, not to the URL which is part of that request, which you can see by comparing these oEmbed requests:
- https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/371...
- https://vimeo.com/api/oembed.json?url=https%3A%2F%2Fplayer.vimeo.com%2Fv...
- https://vimeo.com/api/oembed.json?url=https%3A%2F%2Fplayer.vimeo.com%2Fv...
Note that https://developer.vimeo.com/api/oembed/videos also clearly documents several times that the query parameters should be URL-encoded, e.g. "NOTE: Be sure to URL-encode the url value."
So as far as I can tell, Vimeo requires some custom code to add these query parameters to the oEmbed request, which could happen either in core or a contrib module.
Steps to reproduce
Try to use OEmbed with URLs which require URL encoding to work, e.g. with URL fragments.
Proposed resolution
Revert #3060550: oembed link does not pass the URL parameter to the provider.