update drupal
This commit is contained in:
@@ -162,11 +162,17 @@ class Endpoint {
|
||||
/**
|
||||
* Builds and returns the endpoint URL.
|
||||
*
|
||||
* In most situations this function should not be used. Your are probably
|
||||
* looking for \Drupal\media\OEmbed\UrlResolver::getResourceUrl(), because it
|
||||
* is alterable and also cached.
|
||||
*
|
||||
* @param string $url
|
||||
* The canonical media URL.
|
||||
*
|
||||
* @return string
|
||||
* URL of the oEmbed endpoint.
|
||||
*
|
||||
* @see \Drupal\media\OEmbed\UrlResolver::getResourceUrl()
|
||||
*/
|
||||
public function buildResourceUrl($url) {
|
||||
$query = ['url' => $url];
|
||||
|
||||
+1
-2
@@ -113,8 +113,7 @@ class OEmbedResourceConstraintValidator extends ConstraintValidator implements C
|
||||
// Verify that resource fetching works, because some URLs might match
|
||||
// the schemes but don't support oEmbed.
|
||||
try {
|
||||
$endpoints = $provider->getEndpoints();
|
||||
$resource_url = reset($endpoints)->buildResourceUrl($url);
|
||||
$resource_url = $this->urlResolver->getResourceUrl($url);
|
||||
$this->resourceFetcher->fetchResource($resource_url);
|
||||
}
|
||||
catch (ResourceException $e) {
|
||||
|
||||
@@ -394,10 +394,14 @@ class OEmbed extends MediaSourceBase implements OEmbedInterface {
|
||||
}
|
||||
$remote_thumbnail_url = $remote_thumbnail_url->toString();
|
||||
|
||||
// Remove the query string, since we do not want to include it in the local
|
||||
// thumbnail URI.
|
||||
$local_thumbnail_url = parse_url($remote_thumbnail_url, PHP_URL_PATH);
|
||||
|
||||
// Compute the local thumbnail URI, regardless of whether or not it exists.
|
||||
$configuration = $this->getConfiguration();
|
||||
$directory = $configuration['thumbnails_directory'];
|
||||
$local_thumbnail_uri = "$directory/" . Crypt::hashBase64($remote_thumbnail_url) . '.' . pathinfo($remote_thumbnail_url, PATHINFO_EXTENSION);
|
||||
$local_thumbnail_uri = "$directory/" . Crypt::hashBase64($local_thumbnail_url) . '.' . pathinfo($local_thumbnail_url, PATHINFO_EXTENSION);
|
||||
|
||||
// If the local thumbnail already exists, return its URI.
|
||||
if (file_exists($local_thumbnail_uri)) {
|
||||
|
||||
Reference in New Issue
Block a user