Skip to content

Commit

Permalink
Fix create archive to a continuous writing source file failed
Browse files Browse the repository at this point in the history
#387
Signed-off-by: Yan Zhu <hackzhuyan@gmail.com>
  • Loading branch information
halfcrazy committed Sep 21, 2023
1 parent aa12f39 commit 85ad2b9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,11 @@ func openAndCopyFile(file File, w io.Writer) error {
return err
}
defer fileReader.Close()
_, err = io.Copy(w, fileReader)
return err
_, err = io.CopyN(w, fileReader, file.Size())
if err != nil && err != io.EOF {
return err
}
return nil
}

// fileIsIncluded returns true if filename is included according to
Expand Down

0 comments on commit 85ad2b9

Please sign in to comment.