Skip to content

Commit

Permalink
Pad artifact IDs (#1882)
Browse files Browse the repository at this point in the history
Otherwise the hash can sometimes be short if it results in a low uint64.

Signed-off-by: Will Murphy <will.murphy@anchore.com>
  • Loading branch information
willmurphyscode committed Jun 16, 2023
1 parent badb957 commit e2ed89f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion syft/artifact/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ func IDByHash(obj interface{}) (ID, error) {
return "", fmt.Errorf("could not build ID for object=%+v: %w", obj, err)
}

return ID(fmt.Sprintf("%x", f)), nil
return ID(fmt.Sprintf("%016x", f)), nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
}
},
{
"id": "e7c88bd18e11b0b",
"id": "0e7c88bd18e11b0b",
"location": {
"path": "/a/place/a"
},
Expand Down

0 comments on commit e2ed89f

Please sign in to comment.