Fix fetcher not close file descriptor correctly (#889)
* Fix fetcher not close file descriptor correctly * Call Sync() before chmod
This commit is contained in:
@@ -105,10 +105,19 @@ func downloadUrl(url string, localPath string) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer w.Close()
|
||||
|
||||
_, err = io.Copy(w, resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// flushing write buffer to file
|
||||
err = w.Sync()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = os.Chmod(localPath, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user