aboutsummaryrefslogtreecommitdiff
path: root/s3
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2021-11-20 10:03:16 +0100
committerQuentin <quentin@deuxfleurs.fr>2021-11-20 10:03:16 +0100
commit87fff9843dd60d4ce05596dc55bff44a3724a6bf (patch)
tree6e937656086363cb28320a5484ca148ef8a4a5ba /s3
parent4448577ec154e1f175be3f6668de0aa2d6bfff9e (diff)
downloadbagage-87fff9843dd60d4ce05596dc55bff44a3724a6bf.tar.gz
bagage-87fff9843dd60d4ce05596dc55bff44a3724a6bf.zip
Fix ReadAt
Diffstat (limited to 's3')
-rw-r--r--s3/file.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/s3/file.go b/s3/file.go
index 3d59aa2..b20d247 100644
--- a/s3/file.go
+++ b/s3/file.go
@@ -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) {