mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 17:03:17 +01:00
Base64 encoder closing (#822)
Signed-off-by: houdini91 <mdstrauss91@gmail.com>
This commit is contained in:
parent
641c44f449
commit
e6b5872bc8
@ -64,9 +64,11 @@ func (i *ContentsCataloger) catalogLocation(resolver source.FileResolver, locati
|
|||||||
defer internal.CloseAndLogError(contentReader, location.VirtualPath)
|
defer internal.CloseAndLogError(contentReader, location.VirtualPath)
|
||||||
|
|
||||||
buf := &bytes.Buffer{}
|
buf := &bytes.Buffer{}
|
||||||
if _, err = io.Copy(base64.NewEncoder(base64.StdEncoding, buf), contentReader); err != nil {
|
encoder := base64.NewEncoder(base64.StdEncoding, buf)
|
||||||
|
if _, err = io.Copy(encoder, contentReader); err != nil {
|
||||||
return "", internal.ErrPath{Path: location.RealPath, Err: err}
|
return "", internal.ErrPath{Path: location.RealPath, Err: err}
|
||||||
}
|
}
|
||||||
|
encoder.Close()
|
||||||
|
|
||||||
return buf.String(), nil
|
return buf.String(), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user