build(deps): bump github.com/open-policy-agent/opa from 0.60.0 to 0.61.0
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 0.60.0 to 0.61.0. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v0.60.0...v0.61.0) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
committed by
Ralf Haferkamp
parent
7980be48a1
commit
690d44cfb0
+13
-2
@@ -1465,14 +1465,25 @@ func preProcessBundle(loader DirectoryLoader, skipVerify bool, sizeLimitBytes in
|
||||
}
|
||||
|
||||
func readFile(f *Descriptor, sizeLimitBytes int64) (bytes.Buffer, error) {
|
||||
if bb, ok := f.reader.(*bytes.Buffer); ok {
|
||||
_ = f.Close() // always close, even on error
|
||||
|
||||
if int64(bb.Len()) >= sizeLimitBytes {
|
||||
return *bb, fmt.Errorf("bundle file '%v' size (%d bytes) exceeded max size (%v bytes)",
|
||||
strings.TrimPrefix(f.Path(), "/"), bb.Len(), sizeLimitBytes-1)
|
||||
}
|
||||
|
||||
return *bb, nil
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
n, err := f.Read(&buf, sizeLimitBytes)
|
||||
f.Close() // always close, even on error
|
||||
_ = f.Close() // always close, even on error
|
||||
|
||||
if err != nil && err != io.EOF {
|
||||
return buf, err
|
||||
} else if err == nil && n >= sizeLimitBytes {
|
||||
return buf, fmt.Errorf("bundle file '%v' exceeded max size (%v bytes)", strings.TrimPrefix(f.Path(), "/"), sizeLimitBytes-1)
|
||||
return buf, fmt.Errorf(maxSizeLimitBytesErrMsg, strings.TrimPrefix(f.Path(), "/"), n, sizeLimitBytes-1)
|
||||
}
|
||||
|
||||
return buf, nil
|
||||
|
||||
Reference in New Issue
Block a user