mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-05-14 10:13:52 -04:00
Handle fetch of text/plain as <pre> (#8340)
* Handle fetch of text/plain as <pre> fix https://github.com/FreshRSS/FreshRSS/issues/8328 * class="text-plain"
This commit is contained in:
committed by
GitHub
parent
7e5d2d0727
commit
ae2ab45266
@@ -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" . '<pre class="text-plain">' . htmlspecialchars($body, ENT_NOQUOTES, 'UTF-8') . '</pre>';
|
||||
} else {
|
||||
$body = self::enforceHtmlBase($body, $c_effective_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user