hugolib: Fix error when deleting a bundle in server mode
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 15 Aug 2018 15:14:03 +0000 (17:14 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 16 Aug 2018 10:54:59 +0000 (12:54 +0200)
Fixes #5077

hugolib/page_bundler_capture.go

index 92b3efe495ff94e0afeff0a803c7f2acc5ee247c..15a80681e1f65fec0820e1a358733c13d9afd208 100644 (file)
@@ -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)