diff --git a/syft/format/common/spdxhelpers/to_format_model.go b/syft/format/common/spdxhelpers/to_format_model.go index a394666a94b..b9010d3fa67 100644 --- a/syft/format/common/spdxhelpers/to_format_model.go +++ b/syft/format/common/spdxhelpers/to_format_model.go @@ -845,9 +845,10 @@ func trimPatchVersion(semver string) string { // with the root of the package archive or directory func convertAbsoluteToRelative(absPath string) (string, error) { // Ensure the absolute path is absolute (although it should already be) - absPath, err := filepath.Abs(absPath) - if err != nil { - return "", fmt.Errorf("error converting absPath to absolute path: %v", err) + if !filepath.IsAbs(absPath) { + // already relative + log.Debugf("%s is already relative", absPath) + return absPath, nil } // we use "/" here given that we're converting absolute paths from root to relative