Centralize digest validation in public bundle API
This commit is contained in:
@@ -11,7 +11,8 @@ import (
|
||||
|
||||
var digestPattern = regexp.MustCompile(`^sha256:[0-9a-f]{64}$`)
|
||||
|
||||
func validateDigest(value string) error {
|
||||
// ValidateDigest reports whether value uses the lowercase sha256:<64 hex> form.
|
||||
func ValidateDigest(value string) error {
|
||||
if !digestPattern.MatchString(value) {
|
||||
return fmt.Errorf("must be lowercase sha256:<64 hex>")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user