forked from mirror/afero
Return error instead of panic in WriteReader
See https://github.com/gohugoio/hugo/issues/4240
This commit is contained in:
parent
57afd63c68
commit
bb8f1927f2
3
util.go
3
util.go
|
@ -20,7 +20,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -46,7 +45,7 @@ func WriteReader(fs Fs, path string, r io.Reader) (err error) {
|
||||||
err = fs.MkdirAll(ospath, 0777) // rwx, rw, r
|
err = fs.MkdirAll(ospath, 0777) // rwx, rw, r
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err != os.ErrExist {
|
if err != os.ErrExist {
|
||||||
log.Panicln(err)
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue