From e84d5dd5a1b439b036f3527bbe4e5c1ab33b0a0e Mon Sep 17 00:00:00 2001
From: Cerdic <cedric@yterium.com>
Date: Tue, 28 May 2024 11:21:03 +0200
Subject: [PATCH] =?UTF-8?q?fix:=20utiliser=20la=20fonction=20attribut=5Fur?=
 =?UTF-8?q?l()=20pour=20ins=C3=A9rer=20une=20URL=20dans=20un=20attribut=20?=
 =?UTF-8?q?src=20d'une=20image?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/filtres.php           | 4 ++--
 ecrire/inc/math.php              | 2 +-
 ecrire/inc/presenter_enfants.php | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php
index 8205df4931..23ad2a5461 100644
--- a/ecrire/inc/filtres.php
+++ b/ecrire/inc/filtres.php
@@ -504,7 +504,7 @@ function image_filtrer($args) {
 			return file_exists($path);
 		};
 		if ($is_local_file($is_file) || tester_url_absolue($is_file)) {
-			$res = $filtre("<img src='$is_file'>", ...$args);
+			$res = $filtre("<img src='" . attribut_url($is_file) . "'>", ...$args);
 			statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo
 			return $res;
 		}
@@ -3453,7 +3453,7 @@ function http_img_pack($img, $alt, $atts = '', $title = '', $options = []) {
 	else {
 		$alt = " alt='" . attribut_html($title) . "'";
 	}
-	return "<img src='" . attribut_html($img_file) . "'$alt"
+	return "<img src='" . attribut_url($img_file) . "'$alt"
 	. ($title ? ' title="' . attribut_html($title) . '"' : '')
 	. ' ' . ltrim($atts)
 	. '>';
diff --git a/ecrire/inc/math.php b/ecrire/inc/math.php
index d255c65480..ad7081a903 100644
--- a/ecrire/inc/math.php
+++ b/ecrire/inc/math.php
@@ -63,7 +63,7 @@ function produire_image_math($tex) {
 			[, , , $size] = @spip_getimagesize($fichier);
 			$alt = "alt=\"$tex\" title=\"$tex\"";
 
-			return "<img src=\"$fichier\" style=\"vertical-align:middle;\" $size $alt />";
+			return "<img src=\"" . attribut_url($fichier) . "\" style=\"vertical-align:middle;\" $size $alt />";
 		}
 	} else // pas de fichier
 	{
diff --git a/ecrire/inc/presenter_enfants.php b/ecrire/inc/presenter_enfants.php
index 599548e092..b685ab35af 100644
--- a/ecrire/inc/presenter_enfants.php
+++ b/ecrire/inc/presenter_enfants.php
@@ -65,7 +65,7 @@ function enfant_rub($collection, $debut = 0, $limite = 500) {
 
 			if ($voir_logo && ($logo = $chercher_logo($id_rubrique, 'id_rubrique', 'on'))) {
 				[$fid, $dir, $nom, $format] = $logo;
-				$logo = image_recadre_avec_fallback("<img src='$fid' alt=''>", 70, 70);
+				$logo = image_recadre_avec_fallback("<img src='" . attribut_url($fid) . "' alt=''>", 70, 70);
 				if ($logo) {
 					$logo = wrap(inserer_attribut($logo, 'class', 'logo'), '<span class="logo-carre">');
 				}
-- 
GitLab