From fa0e16f4c79a703d122f1e3a3a99f4b779aea9b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 27 Jun 2023 09:16:42 +0200 Subject: Fix false path warnings with resources.PostProcess Fixes #7735 --- hugolib/hugo_sites_build.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'hugolib') diff --git a/hugolib/hugo_sites_build.go b/hugolib/hugo_sites_build.go index c552b9de8..ea73c493f 100644 --- a/hugolib/hugo_sites_build.go +++ b/hugolib/hugo_sites_build.go @@ -143,6 +143,21 @@ func (h *HugoSites) Build(config BuildCfg, events ...fsnotify.Event) error { if err := h.render(infol, conf); err != nil { h.SendError(fmt.Errorf("render: %w", err)) } + + if h.Configs.Base.LogPathWarnings { + // We need to do this before any post processing, as that may write to the same files twice + // and create false positives. + hugofs.WalkFilesystems(h.Fs.PublishDir, func(fs afero.Fs) bool { + if dfs, ok := fs.(hugofs.DuplicatesReporter); ok { + dupes := dfs.ReportDuplicates() + if dupes != "" { + h.Log.Warnln("Duplicate target paths:", dupes) + } + } + return false + }) + } + if err := h.postProcess(infol); err != nil { h.SendError(fmt.Errorf("postProcess: %w", err)) } -- cgit v1.2.3