LPS-36819 (Fix in master) Add validate method to check whether the image type contains illegal characters.

Please review.
Thanks.