Merge branch 'fix/static-page-double-encoding' into dev
Build and Deploy (dev) / build (push) Successful in 4m40s

This commit is contained in:
eric.bus committed 2026-11-24 15:27:38 +01:00
commit 75b9f0b659
2 files changed
+18

No files matched your search

@@ -21,6 +21,9 @@ class ContactController extends Controller
if ($page->edited) {
$page->edited = Controller::JsonToDateTime($page->edited);
}
if (isset($page->content) && is_string($page->content)) {
$page->content = Controller::fixDoubleEncodedEntities($page->content);
}
return view('contact', ['page' => $page]);
}
+15
View File
@@ -240,7 +240,22 @@ class Controller extends BaseController
if (isset($page->edited) && $page->edited) {
$page->edited = Controller::JsonToDateTime($page->edited);
}
if (isset($page->content) && is_string($page->content)) {
$page->content = self::fixDoubleEncodedEntities($page->content);
}
return view('static', compact('page'));
}
/**
* The API returns headers of static pages HTML-escaped twice, so an '&'
* typed in the intranet editor shows up as '&' on the site
* (e.g. '<h2>GOOI&amp;amp;meer Radio</h2>'). Undo that second encoding:
* '&amp;amp;' -> '&amp;', '&amp;#039;' -> '&#039;', etc.
* Can be removed once the API is fixed.
*/
public static function fixDoubleEncodedEntities($html)
{
return preg_replace('/&amp;(#[0-9]+|#x[0-9a-f]+|[a-z][a-z0-9]*);/i', '&$1;', $html);
}
}