Skip to content

Commit 613fc25

Browse files
committed
chore: convert IsAbs
Signed-off-by: Christopher Phillips <[email protected]>
1 parent 7e6a804 commit 613fc25

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

syft/format/common/spdxhelpers/to_format_model.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -845,9 +845,10 @@ func trimPatchVersion(semver string) string {
845845
// with the root of the package archive or directory
846846
func convertAbsoluteToRelative(absPath string) (string, error) {
847847
// Ensure the absolute path is absolute (although it should already be)
848-
absPath, err := filepath.Abs(absPath)
849-
if err != nil {
850-
return "", fmt.Errorf("error converting absPath to absolute path: %v", err)
848+
if !filepath.IsAbs(absPath) {
849+
// already relative
850+
log.Debugf("%s is already relative", absPath)
851+
return absPath, nil
851852
}
852853

853854
// we use "/" here given that we're converting absolute paths from root to relative

0 commit comments

Comments
 (0)