Skip to content

Commit

Permalink
Merge pull request #3618 from tonistiigi/gha-offset
Browse files Browse the repository at this point in the history
gha: avoid range requests with too big offset
  • Loading branch information
AkihiroSuda authored Feb 11, 2023
2 parents ad15d56 + 488791a commit 31dde70
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cache/remotecache/gha/gha.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"fmt"
"io"
"os"
"sync"
"time"
Expand Down Expand Up @@ -371,6 +372,13 @@ type readerAt struct {
desc ocispecs.Descriptor
}

func (r *readerAt) ReadAt(p []byte, off int64) (int, error) {
if off >= r.desc.Size {
return 0, io.EOF
}
return r.ReaderAtCloser.ReadAt(p, off)
}

func (r *readerAt) Size() int64 {
return r.desc.Size
}

0 comments on commit 31dde70

Please sign in to comment.