mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 08:53:15 +01:00
resolvers: do not join paths, it is assumed they are already joined
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
d82a0872c9
commit
a05d58686e
@ -74,14 +74,8 @@ func (s DirectoryResolver) FilesByGlob(patterns ...string) ([]file.Reference, er
|
|||||||
func (s DirectoryResolver) MultipleFileContentsByRef(f ...file.Reference) (map[file.Reference]string, error) {
|
func (s DirectoryResolver) MultipleFileContentsByRef(f ...file.Reference) (map[file.Reference]string, error) {
|
||||||
refContents := make(map[file.Reference]string)
|
refContents := make(map[file.Reference]string)
|
||||||
for _, fileRef := range f {
|
for _, fileRef := range f {
|
||||||
resolvedPath := path.Join(s.Path, string(fileRef.Path))
|
contents, err := fileContents(fileRef.Path)
|
||||||
_, err := os.Stat(resolvedPath)
|
|
||||||
if os.IsNotExist(err) {
|
|
||||||
continue
|
|
||||||
} else if err != nil {
|
|
||||||
log.Errorf("path (%s) is not valid: %v", resolvedPath, err)
|
|
||||||
}
|
|
||||||
contents, err := fileContents(file.Path(resolvedPath))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return refContents, fmt.Errorf("could not read contents of file: %s", fileRef.Path)
|
return refContents, fmt.Errorf("could not read contents of file: %s", fileRef.Path)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user