diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-12-31 17:46:11 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-12-31 17:46:11 +0100 |
commit | 7d072fbbe62703c11d2b8a13e840390bbe469bdc (patch) | |
tree | 2efc1a6a966bd0927db02507fd673aaaf404d43b | |
parent | 02d6f5320f4202e2f403151c0aa6902f0a5e3efc (diff) |
source: Make UniqueID ... unique
Fixes #2861
-rw-r--r-- | source/file.go | 2 | ||||
-rw-r--r-- | source/file_test.go | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/source/file.go b/source/file.go index 5877004ca..467c48223 100644 --- a/source/file.go +++ b/source/file.go @@ -137,7 +137,7 @@ func NewFile(relpath string) *File { } f.section = helpers.GuessSection(f.Dir()) - f.uniqueID = helpers.Md5String(f.LogicalName()) + f.uniqueID = helpers.Md5String(f.Path()) return f } diff --git a/source/file_test.go b/source/file_test.go index bbf51f748..517474012 100644 --- a/source/file_test.go +++ b/source/file_test.go @@ -14,6 +14,7 @@ package source import ( + "path/filepath" "strings" "testing" @@ -26,6 +27,11 @@ func TestFileUniqueID(t *testing.T) { assert.Equal(t, "123", f1.UniqueID()) assert.Equal(t, "0cc175b9c0f1b6a831c399e269772661", f2.UniqueID()) + + f3 := NewFile(filepath.FromSlash("test1/index.md")) + f4 := NewFile(filepath.FromSlash("test2/index.md")) + + assert.NotEqual(t, f3.UniqueID(), f4.UniqueID()) } func TestFileString(t *testing.T) { |