hugolib: Fix broken bundle live reload logic

Fixes #6315
Updates #6308
This commit is contained in:
Bjørn Erik Pedersen 2019-09-06 11:03:23 +02:00
parent 24ad429571
commit 901077c036
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -837,15 +837,16 @@ type contentChangeMap struct {
symContent map[string]map[string]bool symContent map[string]map[string]bool
} }
func (m *contentChangeMap) add(filename string, tp bundleDirType) { func (m *contentChangeMap) add(dirname string, tp bundleDirType) {
m.mu.Lock() m.mu.Lock()
dir := filepath.Dir(filename) + helpers.FilePathSeparator if !strings.HasSuffix(dirname, helpers.FilePathSeparator) {
dir = strings.TrimPrefix(dir, ".") dirname += helpers.FilePathSeparator
}
switch tp { switch tp {
case bundleBranch: case bundleBranch:
m.branchBundles[dir] = true m.branchBundles[dirname] = true
case bundleLeaf: case bundleLeaf:
m.leafBundles.Insert(dir, true) m.leafBundles.Insert(dirname, true)
default: default:
panic("invalid bundle type") panic("invalid bundle type")
} }