From ad2059878a8d6ace9669ccc5ff0a8d4e5811ad37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 14 Dec 2022 12:20:13 +0100 Subject: Also consider wrapped errors when checking for file IsNotExist errors Fixes #10534 --- hugolib/site.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'hugolib/site.go') diff --git a/hugolib/site.go b/hugolib/site.go index cbfc4d836..8fb39a1ea 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -20,7 +20,6 @@ import ( "log" "mime" "net/url" - "os" "path" "path/filepath" "regexp" @@ -30,6 +29,7 @@ import ( "strings" "time" + "github.com/gohugoio/hugo/common/herrors" "github.com/gohugoio/hugo/common/htime" "github.com/gohugoio/hugo/common/hugio" "github.com/gohugoio/hugo/common/types" @@ -90,16 +90,16 @@ import ( // // 1. A list of Files is parsed and then converted into Pages. // -// 2. Pages contain sections (based on the file they were generated from), -// aliases and slugs (included in a pages frontmatter) which are the -// various targets that will get generated. There will be canonical -// listing. The canonical path can be overruled based on a pattern. +// 2. Pages contain sections (based on the file they were generated from), +// aliases and slugs (included in a pages frontmatter) which are the +// various targets that will get generated. There will be canonical +// listing. The canonical path can be overruled based on a pattern. // -// 3. Taxonomies are created via configuration and will present some aspect of -// the final page and typically a perm url. +// 3. Taxonomies are created via configuration and will present some aspect of +// the final page and typically a perm url. // -// 4. All Pages are passed through a template based on their desired -// layout based on numerous different elements. +// 4. All Pages are passed through a template based on their desired +// layout based on numerous different elements. // // 5. The entire collection of files is written to disk. type Site struct { @@ -954,7 +954,7 @@ func (s *Site) filterFileEvents(events []fsnotify.Event) []fsnotify.Event { // Throw away any directories isRegular, err := s.SourceSpec.IsRegularSourceFile(ev.Name) - if err != nil && os.IsNotExist(err) && (ev.Op&fsnotify.Remove == fsnotify.Remove || ev.Op&fsnotify.Rename == fsnotify.Rename) { + if err != nil && herrors.IsNotExist(err) && (ev.Op&fsnotify.Remove == fsnotify.Remove || ev.Op&fsnotify.Rename == fsnotify.Rename) { // Force keep of event isRegular = true } -- cgit v1.2.3