Skip to content
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

non-escaped interpolation inside a string broken #1028

Closed
jescalan opened this issue May 20, 2013 · 6 comments
Closed

non-escaped interpolation inside a string broken #1028

jescalan opened this issue May 20, 2013 · 6 comments

Comments

@jescalan
Copy link
Contributor

Illustrated below:

a(href="#{url}") link title //- evaluates the url variable correctly
a(href="!{url}") link title //- does not interpolate at all
@ForbesLindesay
Copy link
Member

The correct syntax is:

a(href="#!{url}") link title

@jescalan
Copy link
Contributor Author

ssssssnap! 💣 - thanks and sorry for missing that!

@jescalan
Copy link
Contributor Author

Just kidding, this still doesn't work. Just tested it with the exact code sample you provided above in a blank jade file and it was not interpolated.

@jescalan
Copy link
Contributor Author

jescalan commented Aug 6, 2013

Any word on this one? I could try to jump in and get a pull request to fix this but I'm not super familiar with the jade codebase - any guidance would be helpful 🐸

@ForbesLindesay
Copy link
Member

Ah, having spent a bit more time looking at this (and understanding more of the code base myself) this is still the expected behavior.

Consider:

a(href='#{domain}/' + somethingIDontTrust) link title

In order to be safe, the entire attribute must be escaped. The interpolation itself isn't escaped at all, meaning that all you need to do to get un-escaped interpolation in attributes is:

a(href!='#{url}') title

The code where the interpolation happens is here but escaping is done very separately.

@jescalan
Copy link
Contributor Author

Perfect, this works great. Thanks @ForbesLindesay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants