-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HSD8-1727: Added patch to hide oEmbed resource error from anonymous u…
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
diff --git a/core/modules/media/src/Plugin/media/Source/OEmbed.php b/core/modules/media/src/Plugin/media/Source/OEmbed.php | ||
index 3f58ca120511badd58c223b8f2e3254eac284ef0..855734dd9f14157c9410ae3978e4b3b8f7ae0c14 100644 | ||
--- a/core/modules/media/src/Plugin/media/Source/OEmbed.php | ||
+++ b/core/modules/media/src/Plugin/media/Source/OEmbed.php | ||
@@ -33,6 +33,8 @@ | ||
use Psr\Log\LoggerInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
use Symfony\Component\Mime\MimeTypes; | ||
+use Drupal\Core\Render\Markup; | ||
+use Drupal\Core\Link; | ||
|
||
/** | ||
* Provides a media source plugin for oEmbed resources. | ||
@@ -243,7 +245,19 @@ public function getMetadata(MediaInterface $media, $name) { | ||
$resource = $this->resourceFetcher->fetchResource($resource_url); | ||
} | ||
catch (ResourceException $e) { | ||
- $this->messenger->addError($e->getMessage()); | ||
+ if ($media->access('update')) { | ||
+ $link = Link::createFromRoute($this->t('edit'), 'entity.media.edit_form', ['media' => $media->id()]); | ||
+ $this->messenger->addError(Markup::create($e->getMessage() . " Update media entity: " . $link->toString())); | ||
+ } | ||
+ $this->logger->error( | ||
+ 'An error occurred while fetching an oEmbed resource for Media ID: %media_id, Embed URL: %media_url, oEmbed Resource URL: %resource_url. Error: @error', | ||
+ [ | ||
+ '%resource_url' => !empty($resource_url) ? $resource_url : 'unknown', | ||
+ '%media_url' => $media_url, | ||
+ '%media_id' => $media->id(), | ||
+ '@error' => $e->getMessage(), | ||
+ ] | ||
+ ); | ||
return NULL; | ||
} | ||
|