From be0903c71a1851a4d13df9de37a2037e7bc431ec Mon Sep 17 00:00:00 2001 From: bep Date: Sun, 31 May 2015 18:54:50 +0200 Subject: [PATCH] Fix FullFilePath Fixes #732 --- hugolib/page.go | 2 +- hugolib/page_test.go | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hugolib/page.go b/hugolib/page.go index 8cb28e035..4abc09c58 100644 --- a/hugolib/page.go +++ b/hugolib/page.go @@ -800,7 +800,7 @@ func (p *Page) Convert() error { } func (p *Page) FullFilePath() string { - return filepath.Join(p.Source.Dir(), p.Source.Path()) + return filepath.Join(p.Dir(), p.LogicalName()) } func (p *Page) TargetPath() (outfile string) { diff --git a/hugolib/page_test.go b/hugolib/page_test.go index 9a65cff47..2bf078f18 100644 --- a/hugolib/page_test.go +++ b/hugolib/page_test.go @@ -667,7 +667,7 @@ func TestSliceToLower(t *testing.T) { } } -func TestTargetPath(t *testing.T) { +func TestPagePaths(t *testing.T) { viper.Reset() defer viper.Reset() @@ -700,10 +700,15 @@ func TestTargetPath(t *testing.T) { p.Node.Site.Permalinks = site_permalinks_setting } - expected := filepath.FromSlash(test.expected) + expectedTargetPath := filepath.FromSlash(test.expected) + expectedFullFilePath := filepath.FromSlash(test.path) - if p.TargetPath() != expected { - t.Errorf("%s => TargetPath expected: '%s', got: '%s'", test.content, expected, p.TargetPath()) + if p.TargetPath() != expectedTargetPath { + t.Errorf("%s => TargetPath expected: '%s', got: '%s'", test.content, expectedTargetPath, p.TargetPath()) + } + + if p.FullFilePath() != expectedFullFilePath { + t.Errorf("%s => FullFilePath expected: '%s', got: '%s'", test.content, expectedFullFilePath, p.FullFilePath()) } } }