add should fail on 40x
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
82f5ec9612
commit
ca23ae441e
|
|
@ -0,0 +1,4 @@
|
|||
FROM debian:9.11
|
||||
|
||||
# Testing that any HTTP failure is handled properly
|
||||
ADD https://httpstat.us/404 .
|
||||
|
|
@ -545,6 +545,11 @@ func DownloadFileToDest(rawurl, dest string, uid, gid int64) error {
|
|||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode >= 400 {
|
||||
return fmt.Errorf("%s failed with %d", rawurl, resp.StatusCode)
|
||||
}
|
||||
|
||||
if err := CreateFile(dest, resp.Body, 0600, uint32(uid), uint32(gid)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue