mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
hugolib: Fix handling of zero-length files
This was a regression in Hugo 0.20. This commit makes sure that zeron-length files are not rendered to file. Fixes #3355
This commit is contained in:
@@ -376,6 +376,20 @@ func TestNewSiteDefaultLang(t *testing.T) {
|
||||
require.Equal(t, hugofs.Os, s.Fs.Destination)
|
||||
}
|
||||
|
||||
// Issue #3355
|
||||
func TestShouldNotWriteZeroLengthFilesToDestination(t *testing.T) {
|
||||
cfg, fs := newTestCfg()
|
||||
|
||||
writeSource(t, fs, filepath.Join("content", "simple.html"), "simple")
|
||||
writeSource(t, fs, filepath.Join("layouts", "_default/single.html"), "{{.Content}}")
|
||||
writeSource(t, fs, filepath.Join("layouts", "_default/list.html"), "")
|
||||
|
||||
s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{})
|
||||
th := testHelper{s.Cfg, s.Fs, t}
|
||||
|
||||
th.assertFileNotExist(filepath.Join("public", "index.html"))
|
||||
}
|
||||
|
||||
// Issue #1176
|
||||
func TestSectionNaming(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
Reference in New Issue
Block a user