Skip to content

Commit

Permalink
chore: convert IsAbs
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Phillips <32073428+spiffcs@users.noreply.github.com>
  • Loading branch information
spiffcs committed Dec 9, 2024
1 parent 7e6a804 commit 613fc25
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions syft/format/common/spdxhelpers/to_format_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 613fc25

Please # to comment.