diff --git a/commands/server.go b/commands/server.go index 045c3754e..ea2600542 100644 --- a/commands/server.go +++ b/commands/server.go @@ -1108,7 +1108,7 @@ func (s *staticSyncer) syncsStaticEvents(staticEvents []fsnotify.Event) error { fromPath := ev.Name - relPath, found := sourceFs.MakePathRelative(fromPath, true) + relPath, found := sourceFs.MakePathRelative(fromPath, false) if !found { // Not member of this virtual host. diff --git a/testscripts/server/server__delete_static_file_publish.txt b/testscripts/server/server__delete_static_file_publish.txt new file mode 100644 index 000000000..7139d72d9 --- /dev/null +++ b/testscripts/server/server__delete_static_file_publish.txt @@ -0,0 +1,26 @@ +# A deleted static file should be removed from the publish dir. + +hugo server & + +waitServer + +exists public/static.txt + +rm static/static.txt + +sleep 2 + +! exists public/static.txt + +stopServer +! stderr . + +-- hugo.toml -- +title = "Hugo Server Test" +baseURL = "https://example.org/" +disableKinds = ["taxonomy", "term", "sitemap"] +-- layouts/all.html -- +All. +-- content/p1.md -- +-- static/static.txt -- +static