Return error instead of panic in WriteReader

See https://github.com/gohugoio/hugo/issues/4240
This commit is contained in:
Bjørn Erik Pedersen 2018-01-15 20:27:20 +01:00
parent 57afd63c68
commit bb8f1927f2
No known key found for this signature in database
GPG Key ID: 330E6E2BD4859D8F
1 changed files with 1 additions and 2 deletions

View File

@ -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
} }
} }
} }