-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
Sanitize modifier may break json format without double encoding #3067
Closed
Comments
@jelleroorda sent me his custom modifier which works great. Might be of help to others as well:
|
Sorted! Now you can pass
|
Nice!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Description
When passing data to a vue component via props, the
sanitize
modifier does not double encode html characters. I'm not sure what the pro's are of this approach, but one of the cons is that now it becomes impossible to pass bard data containing double quotes to a vue component through a prop.How to Reproduce
Long way; shown through a vue component
This chair has a beautiful attribute: "Something"
:chairs="{{ chairs | to_json | sanitize }}"
)The component will now not render, because the json is invalid.
Short way; just inspect the json
This chair has a beautiful attribute: "Something"
{{ chairs | to_json | sanitize }}
You can now see that the quote
"Something"
is messing with the json format. Double encoding the data (by modifying thesanitize
modifier) fixes the issue.Extra Detail
Environment
Statamic 3.0.30 Pro
Laravel 7.30.0
PHP 7.4.9
Workaround
The workaround is to create your own modifier that actually double encodes the data. Feels like this should either be an option for the core modifier, or should be the default? Like I said I'm not entirely sure what the impact would be of changing this default.
The text was updated successfully, but these errors were encountered: