-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GridField
escapes HTML content inappropriately
#11191
Comments
This looks similar to #11200.
|
@sunnysideup Please do not include images of code. It not going to significantly slow you down to type:
|
Thank you for adding the link. I would recommend that you change the title of this ticket so it more accurately reflects the issue. I searched for GridField, summary_fields, escape (and similar words). |
A git bisect shows that this PR introduced the bug. Thankfully that wasn't included in the 5.2.0 release (and I have confirmed locally that a fresh installation of Silverstripe CMS 5.2.0 is not affected). The root cause is GridField trying to be a little too helpful in sanitising values if there's a silverstripe-framework/src/Forms/GridField/GridFieldDataColumns.php Lines 263 to 265 in 3d64eac
Not sure what the best course of action is yet, but I'm leaning towards just reverting that PR. We have 6 months to make the decision before this finds its way to a stable release, so no rush. Some options are:
@lekoala since you implemented the linked PR I'd like to know if you have any thoughts about the best course of action here? |
GridField
escapes HTML content inappropriately
Great work @GuySartorelli - thank you for all your patience with me and your expertise in getting it sorted. |
@GuySartorelli oh i see, that is unexpected, and I was aware of that, but I had hoped the base Nice() method would actually make things simpler... not the opposite. Personally, I don't like the "method_exists" check, so I would be in favor of removing it, but the easy course of action is simply reverting my PR. Maybe it would be simpler to introduce a new base method for "NiceAndSafe" value, and take that as the new default |
We chatted about this in refinement. We concluded that it has too many moving parts to address specifically in CMS 5. We'll revert the PR for now and start a discussion about what the ideal end state should be in CMS 6. |
The issue is still open because while we do have a plan, we haven't taken the time to enact the plan yet. If you are using the |
Reopened #11169 with new ACs for CMS 6 implementation of |
Linked PRs have been merged |
Module version(s) affected
5.2 and5.x-dev , but not 5.1Description
CMS links are malformed. This looks like a regression related to CMS 5 upgrade (suspecting change of default behaviour).
"silverstripe/recipe-cms": "5.1.x-dev"
works as expected"silverstripe/recipe-cms": "~5.x-dev"
does not work as expectedLooks like something was introduced after
5.1
that changes the behaviour.Expected behaviour
Links are clickable (regular HTML links).
Actual behaviour
Malformed HTML (encoded).
How to reproduce
Add this
GridField
to a data object's edit formPossible Solution
I had a quick look at
GridFieldDataColumns
andDBHTMLVarchar
but I couldn't find any obvious changes that would cause this.I found a workaround for this (explicit cast):
Additional Context
Originally raised via tractorcow-farm/silverstripe-fluent#839 but confirmed that this is not related to the Fluent module.
Validations
silverstripe/installer
(with any code examples you've provided)OPTIONS
See #11191 (comment)
Acceptance criteria
Nice
method in CMS 6.PRs
The text was updated successfully, but these errors were encountered: