shithub: hugo

Download patch

ref: 0a88741fe85f4f7aedc02ed748dfeb8ccc073dbf
parent: d999b4e82b42d2a0188e53cb3b78113a0a4827ee
author: Bjørn Erik Pedersen <[email protected]>
date: Wed Aug 15 13:14:03 EDT 2018

hugolib: Fix error when deleting a bundle in server mode

Fixes #5077

--- a/hugolib/page_bundler_capture.go
+++ b/hugolib/page_bundler_capture.go
@@ -135,11 +135,17 @@
 		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 @@
 
 	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)