aboutsummaryrefslogtreecommitdiff
path: root/s3
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2021-11-20 09:53:05 +0100
committerQuentin <quentin@deuxfleurs.fr>2021-11-20 09:53:05 +0100
commit4448577ec154e1f175be3f6668de0aa2d6bfff9e (patch)
tree840e9979d06d1f2117629821b1935d7f9d65fe2b /s3
parent514731cf4b5dd97dc871b9fd84c4d9938900ef79 (diff)
downloadbagage-4448577ec154e1f175be3f6668de0aa2d6bfff9e.tar.gz
bagage-4448577ec154e1f175be3f6668de0aa2d6bfff9e.zip
Path + format
Diffstat (limited to 's3')
-rw-r--r--s3/file.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/s3/file.go b/s3/file.go
index 40b40a1..3d59aa2 100644
--- a/s3/file.go
+++ b/s3/file.go
@@ -19,6 +19,7 @@ type S3File struct {
objw *io.PipeWriter
donew chan error
pos int64
+ eof bool
entries []fs.FileInfo
Path S3Path
}
@@ -85,12 +86,19 @@ 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 {
+ return 0, io.EOF
+ }
+
log.Printf("s3 ReadAt %v\n", off)
if err := f.loadObject(); err != nil {
return 0, err
}
- return f.obj.ReadAt(p, off)
+ n, err = f.obj.ReadAt(p, off)
+ f.eof = err == io.EOF
+
+ return
}
func (f *S3File) WriteAt(p []byte, off int64) (n int, err error) {