-
Notifications
You must be signed in to change notification settings - Fork 142
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
Strip invalid characters from attributes when outputting. #500
Comments
Hm. I'm not sure how I feel about this. I understand the technical problem of sending this data back to the editor, but I feel like it violates the principle that you shouldn't ever unexpectedly delete user data. |
I agree - but don't like the implication that it just breaks silently either. We could strip and diplay a notification? Maybe just an |
Why can't we encode If we go the "strip" route, we'd only need to strip We have implemented rudimentary stripping in our Shortcake fork: We also changed the double quote syntax to single quote, because single quotes are much less likely to appear in regular text: (Neither of those changes feel solid enough to make a PR for, but I'd be happy to assist in any way.) |
We can and do. This issue is to accommodate the scenario where |
Thanks for explaining @danielbachhuber . Why can't all fields should have encode enabled by default? For example, Perhaps by setting |
|
Turns out we can't do this because TinyMCE will automatically unescape these. It looks like this issue could be fixed upstream with the upcoming improvements to Shortcode handling - so we're going to punt this for now. |
It's a shame this won't get resolved for 0.6.0. I think it will be hard to gain major adoption when it takes a single character to break an entire shortcode into an unresolvable mess. |
This problem needs to be solved at the shortcode parsing layer, which is outside the scope of Shortcake. |
That's the ideal solution, but there should be a tradeoff between ideal and pragmatic. Isn't the idea with feature plugins that they should be usable on their own merit? |
Shortcake is usable on its own merit. If this issue is a big concern for you, it's easily possible to extend Shortcake with your own workaround for the time being. |
This is the flip side to #496 - if you've not opted in to encoding attributes, then we should prevent things just breaking.
Currently you can get into trouble if you add certain characters to your attributs. Basically anything that breaks the shortcode parsing.
Encoding is a hack to get around this - but if encoded is disabled - we should strip the following characters
"'[]
. There may be more too. Line breaks perhaps? This ensures people dont end up breaking things.The text was updated successfully, but these errors were encountered: