getgrav / grav-plugin-admin

Grav Admin Plugin
http://getgrav.org
MIT License
354 stars 227 forks source link

Wrong escape handling in metadata #2430

Open Pixelfahnder opened 2 hours ago

Pixelfahnder commented 2 hours ago

When I add html tags to the metadata field in pages (e.g. via the admin panel) the HTML will be escaped and therefore all possibly dangerous characters are replaced by the PHP function htmlspecialchars when using these via TWIG.

These can only be turned off when setting system.strict_mode.twig_compat to true and system.twig.autoescape to false.

Thesese parameters will be used in

The Page.php is the relevant file for me when embedding the variable in a Twig template via {{ page.metadata.test.content|raw }}.

The description in the admin panel states, that both fields are defined as followed:

Therefore I guess the handling in the code files is different from the description. Or am I missing something?

Pixelfahnder commented 2 hours ago

Just another remark. If I add the html code to a field in a page markdown and access it from there it will not be escaped. But then I can't add it via the admin interface, only in expoert mode which is not feasable for less experienced collegues.