From ae2ab45266d7d580879755ac94fc0cbc0ffb4732 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 24 Dec 2025 21:38:38 +0100 Subject: Handle fetch of text/plain as
 (#8340)

* Handle fetch of text/plain as 
fix https://github.com/FreshRSS/FreshRSS/issues/8328

* class="text-plain"
---
 app/Utils/httpUtil.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/Utils/httpUtil.php b/app/Utils/httpUtil.php
index f5cd95738..ba63f0dde 100644
--- a/app/Utils/httpUtil.php
+++ b/app/Utils/httpUtil.php
@@ -407,7 +407,12 @@ final class FreshRSS_http_Util {
 				$body = self::enforceHttpEncoding($body, $c_content_type);
 			}
 			if (in_array($type, ['html'], true)) {
-				$body = self::enforceHtmlBase($body, $c_effective_url);
+				if (stripos($c_content_type, 'text/plain') !== false) {
+					// Plain text to be displayed as preformatted text. Prefixed with UTF-8 BOM
+					$body = "\xEF\xBB\xBF" . '
' . htmlspecialchars($body, ENT_NOQUOTES, 'UTF-8') . '
'; + } else { + $body = self::enforceHtmlBase($body, $c_effective_url); + } } } -- cgit v1.2.3