From 80e9cb43dbfd61171230be6fc8584d10b1ea9433 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 13 Mar 2026 19:16:10 -0500 Subject: [PATCH] fix: normalizar http/https al comparar URL del PDF para evitar duplicado --- services/BotService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/BotService.php b/services/BotService.php index effd256..b2b6291 100644 --- a/services/BotService.php +++ b/services/BotService.php @@ -504,6 +504,7 @@ class BotService { if (!$msg) return; // Adjuntar URL del documento solo si es una URL pública y no está ya incluida en el mensaje + // Normalizar protocolo para la comparación (http vs https no deben importar) if (!empty($terms['documento_url'])) { $docUrl = $terms['documento_url']; $isLocal = ( @@ -511,7 +512,9 @@ class BotService { strpos($docUrl, '127.0.0.1') !== false || preg_match('/https?:\/\/\d+\.\d+\.\d+\.\d+:\d+/', $docUrl) ); - if (!$isLocal && strpos($msg, $docUrl) === false) { + $docUrlNormalized = preg_replace('#^https?://#', '', $docUrl); + $msgNormalized = preg_replace('#https?://#', '', $msg); + if (!$isLocal && strpos($msgNormalized, $docUrlNormalized) === false) { $msg .= "\n\n📄 Documento: " . $docUrl; } }