fix(stream): allow seeking beyond file size per Go convention (#2667)

Remove `offset > size` guard from RangeReadReadAtSeeker.Seek and
DynamicReadAtSeeker.Seek. Go's io.Seeker convention allows seeking
past EOF.

Co-authored-by: Pikachu Ren <40362270+PIKACHUIM@users.noreply.github.com>
This commit is contained in:
Ovear
2026-08-07 22:53:49 +08:00
committed by GitHub
parent 6d4ad58678
commit 7e9082f90e
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -519,7 +519,7 @@ func (r *RangeReadReadAtSeeker) Seek(offset int64, whence int) (int64, error) {
default:
return 0, errors.New("Seek: invalid whence")
}
if offset < 0 || offset > r.ss.GetSize() {
if offset < 0 {
return 0, errors.New("Seek: invalid offset")
}
r.masterOff = offset
+1 -1
View File
@@ -79,7 +79,7 @@ func (r *DynamicReadAtSeeker) Seek(offset int64, whence int) (int64, error) {
return 0, errors.New("Seek: invalid whence")
}
if offset < 0 || offset > r.block.Size() {
if offset < 0 {
return 0, errors.New("Seek: invalid offset")
}
r.offset = offset