diff options
author | Quentin <quentin@deuxfleurs.fr> | 2021-11-20 10:03:16 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2021-11-20 10:03:16 +0100 |
commit | 87fff9843dd60d4ce05596dc55bff44a3724a6bf (patch) | |
tree | 6e937656086363cb28320a5484ca148ef8a4a5ba /s3 | |
parent | 4448577ec154e1f175be3f6668de0aa2d6bfff9e (diff) | |
download | bagage-87fff9843dd60d4ce05596dc55bff44a3724a6bf.tar.gz bagage-87fff9843dd60d4ce05596dc55bff44a3724a6bf.zip |
Fix ReadAt
Diffstat (limited to 's3')
-rw-r--r-- | s3/file.go | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -86,7 +86,10 @@ func (f *S3File) Read(p []byte) (n int, err error) { } func (f *S3File) ReadAt(p []byte, off int64) (n int, err error) { - if f.eof { + stat, err := f.Stat() + if err != nil { + return 0, err + } else if off >= stat.Size() { return 0, io.EOF } @@ -95,10 +98,7 @@ func (f *S3File) ReadAt(p []byte, off int64) (n int, err error) { return 0, err } - n, err = f.obj.ReadAt(p, off) - f.eof = err == io.EOF - - return + return f.obj.ReadAt(p, off) } func (f *S3File) WriteAt(p []byte, off int64) (n int, err error) { |