File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1842,7 +1842,8 @@ func (f *File) readFromWithConcurrency(r io.Reader, concurrency int) (read int64
18421842 off := f .offset
18431843
18441844 for {
1845- n , err := r .Read (b )
1845+ // Fill the entire buffer.
1846+ n , err := io .ReadFull (r , b )
18461847
18471848 if n > 0 {
18481849 read += int64 (n )
@@ -1868,7 +1869,7 @@ func (f *File) readFromWithConcurrency(r io.Reader, concurrency int) (read int64
18681869 }
18691870
18701871 if err != nil {
1871- if err != io .EOF {
1872+ if ! errors . Is ( err , io . EOF ) && ! errors . Is ( err , io .ErrUnexpectedEOF ) {
18721873 errCh <- rwErr {off , err }
18731874 }
18741875 return
@@ -2022,7 +2023,8 @@ func (f *File) ReadFrom(r io.Reader) (int64, error) {
20222023
20232024 var read int64
20242025 for {
2025- n , err := r .Read (b )
2026+ // Fill the entire buffer.
2027+ n , err := io .ReadFull (r , b )
20262028 if n < 0 {
20272029 panic ("sftp.File: reader returned negative count from Read" )
20282030 }
@@ -2039,7 +2041,7 @@ func (f *File) ReadFrom(r io.Reader) (int64, error) {
20392041 }
20402042
20412043 if err != nil {
2042- if err == io .EOF {
2044+ if errors . Is ( err , io .EOF ) || errors . Is ( err , io . ErrUnexpectedEOF ) {
20432045 return read , nil // return nil explicitly.
20442046 }
20452047
You can’t perform that action at this time.
0 commit comments