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

"disablePathToLower" does not work as expected in 0.21 #3374

Closed
xofyarg opened this Issue Apr 21, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@xofyarg
Contributor

xofyarg commented Apr 21, 2017

# commit 793554108763c0984f1a1b1a6ee5744b560d78d0

$ grep -i tolower config.yaml
disablePathToLower: true

$ find content/Test/
content/Test/
content/Test/Post
content/Test/Post/index.md

$ find public/Test/ public/test/
public/Test/
public/Test/index.html
public/Test/index.xml
public/test
public/test/post
public/test/post/index
public/test/post/index/index.html
@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Jun 4, 2017

I can confirm this problem in 0.21

f00b4r0 commented Jun 4, 2017

I can confirm this problem in 0.21

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Jun 4, 2017

Dug a little more, this only affects the directory part of the path. When using uglyURLs, if disablePathToLower is set to true, content/Test/Toto.md generates public/test/Toto.html; and public/test/toto.html if disablePathToLower isn't set.

I know nothing about Go, but I suspect the problem could be coming from this code line

HTH

f00b4r0 commented Jun 4, 2017

Dug a little more, this only affects the directory part of the path. When using uglyURLs, if disablePathToLower is set to true, content/Test/Toto.md generates public/test/Toto.html; and public/test/toto.html if disablePathToLower isn't set.

I know nothing about Go, but I suspect the problem could be coming from this code line

HTH

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Jun 5, 2017

The following 1-liner hack fixes the bug for me (disablePathToLower is correctly honoured for both dirname and filename), so this line is effectively the source of the issue.

diff --git a/hugolib/page_paths.go b/hugolib/page_paths.go
index 1fe8ea5..0f5add2 100644
--- a/hugolib/page_paths.go
+++ b/hugolib/page_paths.go
@@ -85,7 +85,7 @@ func (p *Page) initTargetPathDescriptor() error {
                Kind:     p.Kind,
                Sections: p.sections,
                UglyURLs: p.s.Info.uglyURLs,
-               Dir:      filepath.ToSlash(strings.ToLower(p.Source.Dir())),
+               Dir:      filepath.ToSlash(p.Source.Dir()),
                URL:      p.URLPath.URL,
        }

I'm unable to tell whether this is a sufficient fix or if something else was meant to happen here.

HTH

f00b4r0 commented Jun 5, 2017

The following 1-liner hack fixes the bug for me (disablePathToLower is correctly honoured for both dirname and filename), so this line is effectively the source of the issue.

diff --git a/hugolib/page_paths.go b/hugolib/page_paths.go
index 1fe8ea5..0f5add2 100644
--- a/hugolib/page_paths.go
+++ b/hugolib/page_paths.go
@@ -85,7 +85,7 @@ func (p *Page) initTargetPathDescriptor() error {
                Kind:     p.Kind,
                Sections: p.sections,
                UglyURLs: p.s.Info.uglyURLs,
-               Dir:      filepath.ToSlash(strings.ToLower(p.Source.Dir())),
+               Dir:      filepath.ToSlash(p.Source.Dir()),
                URL:      p.URLPath.URL,
        }

I'm unable to tell whether this is a sufficient fix or if something else was meant to happen here.

HTH

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jun 5, 2017

Member

I'm unable to tell whether this is a sufficient fix or if something else was meant to happen here.

As I'm assuming you have tested only your concern, I would assume not.

Member

bep commented Jun 5, 2017

I'm unable to tell whether this is a sufficient fix or if something else was meant to happen here.

As I'm assuming you have tested only your concern, I would assume not.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Jun 5, 2017

As I said I know nothing about go. All I can provide is a clue where the problem is (took me a quick git grep to find that out) and confirm that the problem is really coming from here, which I did.

I tested both states of disablePathToLower and both states of uglyURLs, and it seems to work as intended now.

I'm merely trying to make progress with this issue which affects the website I wanted to convert to hugo...

Hope that helps still.

f00b4r0 commented Jun 5, 2017

As I said I know nothing about go. All I can provide is a clue where the problem is (took me a quick git grep to find that out) and confirm that the problem is really coming from here, which I did.

I tested both states of disablePathToLower and both states of uglyURLs, and it seems to work as intended now.

I'm merely trying to make progress with this issue which affects the website I wanted to convert to hugo...

Hope that helps still.

@bep bep added the Bug label Jun 5, 2017

@bep bep added this to the v0.22 milestone Jun 5, 2017

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep Jun 5, 2017

Member

I posted a little quick there -- your patch looks sensible, I will have a look.

Member

bep commented Jun 5, 2017

I posted a little quick there -- your patch looks sensible, I will have a look.

@bep bep self-assigned this Jun 5, 2017

@bep bep closed this in 5be0448 Jun 6, 2017

@ghost ghost referenced this issue Jun 12, 2017

Open

spf13/hugo v0.22 released #11

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