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

% characters are stripped out of URLs #1292

Closed
donlzx opened this Issue Jul 20, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@donlzx

donlzx commented Jul 20, 2015

The section variable passed into the pagination module is already URL encoded,

https://github.com/spf13/hugo/blob/master/hugolib/pagination.go#L370

but the pagination URLs are encoded again using function URLizeAndPrep() in

https://github.com/spf13/hugo/blob/master/hugolib/pagination.go#L515

This yields incorrect URLs for pagination templates.

For example, a section name contains accent characters (añame) encoded as a%C3%B1ame, when processed by function URLizeAndPrep(), will become ac3b1ame, the % characters are stripped out.

And there may be other cases for non-English section names which are not handled correctly.

Removing the call to the URLizeAndPrep() function temporarily fix this issue for me, but the URL handling should be reviewed and should be consistent with URLs in Nodes and Pages.

@donlzx donlzx changed the title from Incorrect handling of URLs in pagination module to Incorrect handling of URLs with accents characters Jul 22, 2015

@donlzx

This comment has been minimized.

Show comment
Hide comment
@donlzx

donlzx Jul 22, 2015

It turns out that this issue is not limited to the pagination module. The issues is with the UnicodeSanitize() function stripping % characters in URLs:

https://github.com/spf13/hugo/blob/master/helpers/path.go#L97

donlzx commented Jul 22, 2015

It turns out that this issue is not limited to the pagination module. The issues is with the UnicodeSanitize() function stripping % characters in URLs:

https://github.com/spf13/hugo/blob/master/helpers/path.go#L97

@bep bep changed the title from Incorrect handling of URLs with accents characters to % characters are stripped out of URLs Jul 22, 2015

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jul 22, 2015

Member

This precedes my time with Hugo. @spf13 might now why % are stripped?

Member

bep commented Jul 22, 2015

This precedes my time with Hugo. @spf13 might now why % are stripped?

tischda added a commit to tischda/hugo that referenced this issue Nov 25, 2015

tischda added a commit to tischda/hugo that referenced this issue Nov 25, 2015

@spf13

This comment has been minimized.

Show comment
Hide comment
@spf13

spf13 Nov 28, 2015

Contributor

I just filtered out any character that may be an issue as part of a filename in any os, even some that were ok in urls. It seems innocuous enough to include this back in.

Contributor

spf13 commented Nov 28, 2015

I just filtered out any character that may be an issue as part of a filename in any os, even some that were ok in urls. It seems innocuous enough to include this back in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment