mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Fix panic when changing archetype files when servere is running
Fixes #12195
This commit is contained in:
parent
e62675002e
commit
9ca1de09dd
2 changed files with 20 additions and 0 deletions
|
@ -792,6 +792,8 @@ func (h *HugoSites) processPartial(ctx context.Context, l logg.LevelLogger, conf
|
||||||
// It's hard to determine the exact change set of this,
|
// It's hard to determine the exact change set of this,
|
||||||
// so be very coarse grained for now.
|
// so be very coarse grained for now.
|
||||||
changes = append(changes, identity.GenghisKhan)
|
changes = append(changes, identity.GenghisKhan)
|
||||||
|
case files.ComponentFolderArchetypes:
|
||||||
|
// Ignore for now.
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("unknown component: %q", pathInfo.Component()))
|
panic(fmt.Sprintf("unknown component: %q", pathInfo.Component()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1472,3 +1472,21 @@ all: {{ $ab.RelPermalink }}
|
||||||
b.AddFiles("assets/common/c3.css", "c3").Build()
|
b.AddFiles("assets/common/c3.css", "c3").Build()
|
||||||
b.AssertFileContent("public/ab.css", "abc1c2 editedc3")
|
b.AssertFileContent("public/ab.css", "abc1c2 editedc3")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRebuildEditArchetypeFile(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
baseURL = "https://example.com"
|
||||||
|
disableLiveReload = true
|
||||||
|
-- archetypes/default.md --
|
||||||
|
---
|
||||||
|
title: "Default"
|
||||||
|
---
|
||||||
|
`
|
||||||
|
|
||||||
|
b := TestRunning(t, files)
|
||||||
|
// Just make sure that it doesn't panic.
|
||||||
|
b.EditFileReplaceAll("archetypes/default.md", "Default", "Default Edited").Build()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue