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

safeURL function doesn't escape + character in a template #5253

Closed
akshaybabloo opened this issue Sep 25, 2018 · 4 comments
Closed

safeURL function doesn't escape + character in a template #5253

akshaybabloo opened this issue Sep 25, 2018 · 4 comments

Comments

@akshaybabloo
Copy link
Contributor

akshaybabloo commented Sep 25, 2018

In template safeURL function doesn't escape + character. Example:

Consider the following settings under config.toml:

# config.toml
[params]
  fontFamilyURL = "https://fonts.googleapis.com/css?family=Space+Mono:400,700"

I am then trying to use this in an HTML template as:

<!-- baseOf.html -->
{{ .Site.Params.fontFamilyURL | safeURL }}

The above code generates -> https://fonts.googleapis.com/css?family=Space&#43;Mono:400,700 instead of https://fonts.googleapis.com/css?family=Space+Mono:400,700. You can see that + is replaced by &#43;, but when I use safeHTML, I have no such problem.

The issue is something similar to #5236.

I am using Hugo Static Site Generator v0.49/extended windows/amd64 BuildDate: unknown

@moorereason
Copy link
Contributor

It's not clear to me what you're asking. The title of this issue doesn't match the content you provided. We need more context and clarity to help.

@akshaybabloo akshaybabloo changed the title safeURL doesn't escape + safeURL function doesn't escape + character in a template Nov 19, 2018
@akshaybabloo
Copy link
Contributor Author

@moorereason I updated it, is it clear now?

@moorereason
Copy link
Contributor

The title essentially says the same thing. What's confusing me is that you say that it doesn't escape + in a template, but then you say that it generates &#43;. I consider that to be escaped.

In any case, I don't think this is a bug. I suspect that you are not using the safeURL function properly. Please search the discussion forums for how to use safeURL properly. If you don't find the answer you need, open a new thread in the forums.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants