Skip to content

Commit

Permalink
gha: avoid range requests with too big offset
Browse files Browse the repository at this point in the history
Signed-off-by: Tonis Tiigi <[email protected]>
(cherry picked from commit 488791a)
  • Loading branch information
tonistiigi committed Feb 13, 2023
1 parent b924f0b commit b31ccd0
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 b31ccd0

Please sign in to comment.