From 0a88741fe85f4f7aedc02ed748dfeb8ccc073dbf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 15 Aug 2018 17:14:03 +0200 Subject: [PATCH] hugolib: Fix error when deleting a bundle in server mode Fixes #5077 --- hugolib/page_bundler_capture.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hugolib/page_bundler_capture.go b/hugolib/page_bundler_capture.go index 92b3efe4..15a80681 100644 --- a/hugolib/page_bundler_capture.go +++ b/hugolib/page_bundler_capture.go @@ -135,11 +135,17 @@ func (c *capturer) capturePartial(filenames ...string) error { switch tp { case bundleLeaf: if err := c.handleDir(resolvedFilename); err != nil { - return err + // Directory may have been deleted. + if !os.IsNotExist(err) { + return err + } } case bundleBranch: if err := c.handleBranchDir(resolvedFilename); err != nil { - return err + // Directory may have been deleted. + if !os.IsNotExist(err) { + return err + } } default: fi, err := c.resolveRealPath(resolvedFilename) @@ -510,7 +516,7 @@ func (c *capturer) readDir(dirname string) (pathLangFileFis, error) { dir, err := c.fs.Open(dirname) if err != nil { - return nil, fmt.Errorf("readDir: %s", err) + return nil, err } defer dir.Close() fis, err := dir.Readdir(-1) -- 2.30.2