From 172f01a6a2e9bf294ea5959b34d91b87c6a50f16 Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Tue, 4 Oct 2022 23:39:31 +0100
Subject: [PATCH] Issue #3310510 by igorbarato, Anchal_gupta: Harden error
 logging of OEmbed thumbnail fetching logic (YouTube errors contain special
 characters)

(cherry picked from commit c36f03ae2bdb59a4970ff1470c62c9eded56a954)
---
 core/modules/media/src/Plugin/media/Source/OEmbed.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/modules/media/src/Plugin/media/Source/OEmbed.php b/core/modules/media/src/Plugin/media/Source/OEmbed.php
index c1a870731e72..87e53f3da2bf 100644
--- a/core/modules/media/src/Plugin/media/Source/OEmbed.php
+++ b/core/modules/media/src/Plugin/media/Source/OEmbed.php
@@ -447,7 +447,9 @@ protected function getLocalThumbnailUri(Resource $resource) {
       }
     }
     catch (TransferException $e) {
-      $this->logger->warning($e->getMessage());
+      $this->logger->warning('Failed to download remote thumbnail file due to "%error".', [
+        '%error' => $e->getMessage(),
+      ]);
     }
     catch (FileException $e) {
       $this->logger->warning('Could not download remote thumbnail from {url}.', [
-- 
GitLab