ref: 0abdeeef6740a3cbba0db95374853d040f2022b8
parent: e2f8664ef4278e14ce1e21376804321fa013f570
author: Matthieu Harlé <[email protected]>
date: Wed Aug 9 11:42:50 EDT 2017
source: Normalize UniqueID between Windows & Linux
--- a/source/file.go
+++ b/source/file.go
@@ -155,7 +155,7 @@
}
f.section = helpers.GuessSection(f.Dir())
- f.uniqueID = helpers.Md5String(f.Path())
+ f.uniqueID = helpers.Md5String(filepath.ToSlash(f.relpath))
return f
}
--- a/source/file_test.go
+++ b/source/file_test.go
@@ -37,6 +37,11 @@
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) {