diff options
author | Matthieu Harlé <[email protected]> | 2017-08-09 15:42:50 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2017-08-09 19:35:40 +0200 |
commit | 0abdeeef6740a3cbba0db95374853d040f2022b8 (patch) | |
tree | 50a882ec6d5e53f2d8eae024c5533a9a7eefa980 /source | |
parent | e2f8664ef4278e14ce1e21376804321fa013f570 (diff) | |
download | hugo-0abdeeef6740a3cbba0db95374853d040f2022b8.tar.gz hugo-0abdeeef6740a3cbba0db95374853d040f2022b8.zip |
source: Normalize UniqueID between Windows & Linux
Diffstat (limited to 'source')
-rw-r--r-- | source/file.go | 2 | ||||
-rw-r--r-- | source/file_test.go | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/source/file.go b/source/file.go index cbd83d17b..a630431c6 100644 --- a/source/file.go +++ b/source/file.go @@ -155,7 +155,7 @@ func (sp SourceSpec) NewFile(relpath string) *File { } f.section = helpers.GuessSection(f.Dir()) - f.uniqueID = helpers.Md5String(f.Path()) + f.uniqueID = helpers.Md5String(filepath.ToSlash(f.relpath)) return f } diff --git a/source/file_test.go b/source/file_test.go index a152b4bf5..64ad6fb46 100644 --- a/source/file_test.go +++ b/source/file_test.go @@ -37,6 +37,11 @@ func TestFileUniqueID(t *testing.T) { f4 := ss.NewFile(filepath.FromSlash("test2/index.md")) assert.NotEqual(t, f3.UniqueID(), f4.UniqueID()) + + f5l := ss.NewFile("test3/index.md") + f5w := ss.NewFile(filepath.FromSlash("test3/index.md")) + + assert.Equal(t, f5l.UniqueID(), f5w.UniqueID()) } func TestFileString(t *testing.T) { |