Skip to content

Commit

Permalink
Use io.Copy to avoid crash due to insufficient memory
Browse files Browse the repository at this point in the history
  • Loading branch information
crazy-max committed Jul 27, 2019
1 parent 8a4d41a commit 1843c79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 6.0.2 (2019/07/27)

* Use `io.Copy` to avoid crash due to insufficient memory

## 6.0.1 (2019/07/24)

* Fix cron stopped after first trigger
Expand Down
8 changes: 1 addition & 7 deletions internal/server/ftp/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"os"
"regexp"
"time"
Expand Down Expand Up @@ -108,12 +107,7 @@ func (c *Client) Retrieve(path string, dest io.Writer) error {
}
defer resp.Close()

buf, err := ioutil.ReadAll(resp)
if err != nil {
return err
}

_, err = dest.Write(buf)
_, err = io.Copy(dest, resp)
return err
}

Expand Down

0 comments on commit 1843c79

Please sign in to comment.