From 63e96720125364c1961b7ec5a5da88ef1a776bc1 Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Thu, 16 May 2024 11:00:12 +0200
Subject: [PATCH] =?UTF-8?q?fix:=20=C3=A9viter=20une=20preg=20sur=20les=20l?=
 =?UTF-8?q?ongues=20cha=C3=AEnes=20si=20pas=20necessaire=20(perf=20issue)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/svg.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ecrire/inc/svg.php b/ecrire/inc/svg.php
index b53f1e79b3..f1666debf8 100644
--- a/ecrire/inc/svg.php
+++ b/ecrire/inc/svg.php
@@ -133,7 +133,9 @@ function svg_nettoyer($svg) {
 		$svg = str_replace('<svg', '<svg xmlns="http://www.w3.org/2000/svg"', $svg);
 	}
 	// Supprimer les commentaires
-	$svg = preg_replace(',<!--.*-->,Us', '', $svg);
+	if (str_contains($svg, '<!--')) {
+		$svg = preg_replace(',<!--.*-->,Us', '', $svg);
+	}
 
 	return $svg;
 }
-- 
GitLab