From 3dff30ab73e2a29810b67313bec87a59e2eacc3a Mon Sep 17 00:00:00 2001 From: "Carlos (Almeira)" Date: Thu, 20 Aug 2026 09:50:14 -0500 Subject: [PATCH] fix: resolve video playback issue in publications using view endpoint and legacy URL normalization --- src/app/[slug]/page.tsx | 10 +++++++--- src/app/actions/entities.ts | 16 ++++++++++------ src/components/dashboard/MediaGridSelector.tsx | 2 +- src/components/dashboard/RichTextEditor.tsx | 13 ++++++++++--- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/app/[slug]/page.tsx b/src/app/[slug]/page.tsx index 0913f87..52e5b1f 100644 --- a/src/app/[slug]/page.tsx +++ b/src/app/[slug]/page.tsx @@ -10,12 +10,16 @@ import { Metadata, ResolvingMetadata } from 'next'; function formatTextToHtml(text: string) { if (!text) return ''; + // Normalize any video preview URLs to view URLs for legacy content + const normalizedText = text + .replace(/(]*src=["'])([^"']*)\/preview\?([^"']*["'])/gi, '$1$2/view?$3') + .replace(/(]*src=["'])([^"']*)\/preview\?([^"']*["'])/gi, '$1$2/view?$3'); // Si ya contiene etiquetas estructurales de HTML (párrafos, saltos, divs, listas), lo devolvemos tal cual - if (/<\/?(?:p|br|div|h[1-6]|ul|ol|li|table)[^>]*>/i.test(text)) { - return text; + if (/<\/?(?:p|br|div|h[1-6]|ul|ol|li|table)[^>]*>/i.test(normalizedText)) { + return normalizedText; } // Convertimos texto plano con saltos de línea a párrafos y
, permitiendo que etiquetas inline como o