mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Also consider wrapped errors when checking for file IsNotExist errors
Fixes #10534
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/common/text"
|
||||
|
||||
"github.com/gohugoio/hugo/config"
|
||||
@@ -378,7 +379,7 @@ func OpenFileForWriting(fs afero.Fs, filename string) (afero.File, error) {
|
||||
// os.Create will create any new files with mode 0666 (before umask).
|
||||
f, err := fs.Create(filename)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
if !herrors.IsNotExist(err) {
|
||||
return nil, err
|
||||
}
|
||||
if err = fs.MkdirAll(filepath.Dir(filename), 0777); err != nil { // before umask
|
||||
|
Reference in New Issue
Block a user