-
-
Notifications
You must be signed in to change notification settings - Fork 861
Description
Bug Report
Current Behavior
Error when accessing the forum after saving in the admin panel a custom CSS code of +68000 characters (doesn't mean it's exactly that number, in my case I've experienced it when reaching that number of characters).
This causes that when saving the CSS code the last lines are cut, and therefore in my case for example this caused a ParseError: missing closing'}' error in the entire forum because it just cut the code before a }
Steps to Reproduce
- Go to admin panel ->Appearance -> Edit custom CSS
- Paste the CSS code
- Save (no error will appear)
After this if you reopen the Edit Custom CSS box you will see the cut code - Go to the forum and you will see an error (depending on where the CSS code is cut) or lack of changes
Expected Behavior
Avoid cutting the CSS code when it has ±68000 characters through the admin panel.
Environment
- Flarum version: 1.0.4
Possible Solution (by @clarkwinkelmann)
We have a step to validate the Less but the code probably gets truncated when inserted in the database, so the validation won't catch it https://github.com/flarum/core/blob/master/src/Forum/ValidateCustomLess.php
We should probably add max length validation for all settings. This probably has never been an issue in the past because most settings are short strings and there was never any risk of reaching the
TEXTlimitation.