Skip to content

Commit

Permalink
Merge pull request #3 from jessehardy/main
Browse files Browse the repository at this point in the history
fix: afc open download truncation
  • Loading branch information
electricbubble authored May 18, 2021
2 parents f7e28cd + 9320e16 commit 8c797a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions afc.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ func (c *afc) ReadDir(dirname string) (names []string, err error) {
if respMsg, err = c.client.Receive(); err != nil {
return nil, fmt.Errorf("afc receive 'ReadDir': %w", err)
}
if err = respMsg.Err(); err != nil {
return nil, fmt.Errorf("afc 'ReadDir': %w", err)
}

names = respMsg.Strings()
return
Expand Down Expand Up @@ -450,6 +453,8 @@ func (f *AfcFile) Read(b []byte) (n int, err error) {

if f.reader == nil {
f.reader = bytes.NewReader(respMsg.Payload)
} else {
f.reader.Reset(respMsg.Payload)
}

return f.reader.Read(b)
Expand Down

0 comments on commit 8c797a4

Please sign in to comment.