importer: stream oci-layout and manifest.json
Signed-off-by: Samuel Karp <samuelkarp@google.com>
This commit is contained in:
parent
a43d719ce2
commit
9e4acc0280
@ -233,12 +233,14 @@ func ImportIndex(ctx context.Context, store content.Store, reader io.Reader, opt
|
||||
return writeManifest(ctx, store, idx, ocispec.MediaTypeImageIndex)
|
||||
}
|
||||
|
||||
const (
|
||||
kib = 1024
|
||||
mib = 1024 * kib
|
||||
jsonLimit = 20 * mib
|
||||
)
|
||||
|
||||
func onUntarJSON(r io.Reader, j interface{}) error {
|
||||
b, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return json.Unmarshal(b, j)
|
||||
return json.NewDecoder(io.LimitReader(r, jsonLimit)).Decode(j)
|
||||
}
|
||||
|
||||
func onUntarBlob(ctx context.Context, r io.Reader, store content.Ingester, size int64, ref string) (digest.Digest, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user