From f2a66be51eccfa0c0f847295008b875e9cf5428b Mon Sep 17 00:00:00 2001 From: IliesAllali Date: Wed, 30 Sep 2026 18:02:10 +0200 Subject: [PATCH] =?UTF-8?q?Vid=C3=A9os=20YouTube=20:=20identifiant=20v?= =?UTF-8?q?=C3=A9rifi=C3=A9,=20lecteur=20youtube-nocookie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'identifiant doit faire 11 caractères (lettres, chiffres, - et _), sinon rien n'est intégré. Le lecteur vient de youtube-nocookie.com. La carte OpenStreetMap n'envoie plus que l'origine en referrer, plus l'adresse de l'arbre. Co-Authored-By: Claude Opus 5.5 --- frontend/src/components/MediaViewer.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/MediaViewer.jsx b/frontend/src/components/MediaViewer.jsx index 3a17b39..d666fc6 100644 --- a/frontend/src/components/MediaViewer.jsx +++ b/frontend/src/components/MediaViewer.jsx @@ -135,15 +135,17 @@ const MediaViewer = ({ media, person, onClose }) => { // Extract YouTube video ID and build embed URL const watchMatch = mediaUrl.match(/[?&]v=([^&]+)/) const shortMatch = mediaUrl.match(/youtu\.be\/([^/?]+)/) - const videoId = (watchMatch?.[1] || shortMatch?.[1] || '').split('?')[0] - if (!videoId) { + const videoId = (watchMatch?.[1] || shortMatch?.[1] || '').split(/[?#]/)[0] + // Un identifiant YouTube fait 11 caractères : tout le reste est refusé plutôt qu'intégré + if (!/^[A-Za-z0-9_-]{11}$/.test(videoId)) { return (
{t('Lien YouTube invalide')}
) } - const embedUrl = `https://www.youtube.com/embed/${videoId}` + // youtube-nocookie : pas de cookie YouTube tant que la vidéo n'est pas lancée + const embedUrl = `https://www.youtube-nocookie.com/embed/${videoId}` return (