Restrict locals to valid variable names #158

Merged
merged 2 commits into from Nov 30, 2012

Projects

None yet

3 participants

@thinkerbot

Local keys are evaluated as ruby meaning all kinds of shenanigans are possible unless the keys are filtered. Restricting them to variable names seems safe and reasonable.

I ran across this when accidentally passing something like A/B as a key, which failed trying to divide missing constants.

@thinkerbot thinkerbot Restrict locals to valid variable names
Local keys are evaluated as ruby meaning all kinds of shenanigans are possible
unless the keys are filtered.  Restricting them to variable names seems safe
and reasonable.
3b6b9e2
@judofyr
Collaborator
judofyr commented Nov 29, 2012

Isn't it better to raise an error in this case?

Simon Chiang Raise error on locals with non-variable key
Rather than swallowing invalid locals, notify the user something is wrong.
Among other things this will allow the user to more easily identify errors in
their template.
d4c6720
@thinkerbot

@judofyr yes, it is. Corrected!

@judofyr
Collaborator
judofyr commented Nov 30, 2012

@rtomayko: Thoughts?

@rtomayko
Owner

👍

@rtomayko rtomayko merged commit f270166 into rtomayko:master Nov 30, 2012

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment