Merge pull request #490 from glebteterin/bug-489

Fix missing io.EOF when concurency is disabled #489
This commit is contained in:
Cassondra Foesch 2022-01-19 19:28:00 +00:00 committed by GitHub
commit 7d25d533c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 4 deletions

View File

@ -999,9 +999,6 @@ func (f *File) readAtSequential(b []byte, off int64) (read int, err error) {
read += n
}
if err != nil {
if errors.Is(err, io.EOF) {
return read, nil // return nil explicitly.
}
return read, err
}
}

View File

@ -1203,7 +1203,7 @@ func TestClientReadSequential(t *testing.T) {
stuff := make([]byte, 32)
n, err := sftpFile.Read(stuff)
require.NoError(t, err)
require.ErrorIs(t, err, io.EOF)
require.Equal(t, len(content), n)
require.Equal(t, content, stuff[0:len(content)])