mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
source: Normalize UniqueID between Windows & Linux
This commit is contained in:
parent
e2f8664ef4
commit
0abdeeef67
2 changed files with 6 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue