hugolib: Fix error when deleting a bundle in server mode

Fixes #5077
This commit is contained in:
Bjørn Erik Pedersen 2018-08-15 17:14:03 +02:00
parent d999b4e82b
commit 0a88741fe8

View file

@ -135,12 +135,18 @@ func (c *capturer) capturePartial(filenames ...string) error {
switch tp {
case bundleLeaf:
if err := c.handleDir(resolvedFilename); err != nil {
// Directory may have been deleted.
if !os.IsNotExist(err) {
return err
}
}
case bundleBranch:
if err := c.handleBranchDir(resolvedFilename); err != nil {
// Directory may have been deleted.
if !os.IsNotExist(err) {
return err
}
}
default:
fi, err := c.resolveRealPath(resolvedFilename)
if os.IsNotExist(err) {
@ -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)