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

URLs with query params should have & escaped #11

Open
dshorthouse opened this issue Mar 13, 2014 · 9 comments
Open

URLs with query params should have & escaped #11

dshorthouse opened this issue Mar 13, 2014 · 9 comments
Labels

Comments

@dshorthouse
Copy link
Contributor

In the goc branch and perhaps elsewhere (eg https://github.com/Canadensys/canadensys-explorer/blob/goc/src/main/webapp/WEB-INF/view/view-stats.ftl#L22), the URLs returned from URL.replaceCurrentQueryParam & URL.replaceCurrentQueryParams should have their ampersands escaped as &

@cgendreau
Copy link
Contributor

Should we assume that a function like replaceCurrentQueryParam will always use an HTML escaped string?

@dshorthouse
Copy link
Contributor Author

Possibly. Under what circumstances would it not be presented as HTML?

@cgendreau
Copy link
Contributor

The FreemarkerURLHelper can be used to generate JavaScript, XML, JSON ...

@dshorthouse
Copy link
Contributor Author

Right. I suppose we might eventually generate those views. Well, what about escaping the URLs in the HTML views? Does FreeMarker have a helper method? Both ?html and ?url('UTF-8') aren't quite the right solution IMO because they're too greedy.

@cgendreau
Copy link
Contributor

Freemarker helper method is ?html. Why too greedy?

Canadensys/canadensys-web-core#1

@cgendreau
Copy link
Contributor

We could also escape the whole block and maybe the whole file through configuration.

@dshorthouse
Copy link
Contributor Author

Argh. Never mind re: too greedy. I confused a quick little ?html output with output from ?url('UTF-8'). Looks like ?html is exactly what we want. http://freemarker.org/docs/ref_builtins_string.html#ref_builtin_html

@cgendreau
Copy link
Contributor

that's what I did in the last commit but an escape block would be even better (for the eyes).
http://freemarker.org/docs/ref_directive_escape.html

Anyway, those lines will need a macro at some point.

@dshorthouse
Copy link
Contributor Author

Yes, and ?html or an escape directive will have to be used throughout the app eg language switcher, content from data providers, etc. Essentially anywhere we might render a URL.

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

No branches or pull requests

2 participants