Signed-off-by: John Howard <jhoward@microsoft.com> Upstream-commit: 52f4d09ffb376ffaa6677cb1e0413c6a97f53f24 Component: engine
17 lines
293 B
Go
17 lines
293 B
Go
package image
|
|
|
|
import (
|
|
"fmt"
|
|
"regexp"
|
|
)
|
|
|
|
var validHex = regexp.MustCompile(`^([a-f0-9]{64})$`)
|
|
|
|
// Check wheather id is a valid image ID or not
|
|
func ValidateID(id string) error {
|
|
if ok := validHex.MatchString(id); !ok {
|
|
return fmt.Errorf("image ID '%s' is invalid", id)
|
|
}
|
|
return nil
|
|
}
|