Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ImageTypeJpeg is type of Jpeg. ImageTypeJpeg = "jpeg" // ImageTypeGif is type of Gif. ImageTypeGif = "gif" // ImageTypePng is type of PNG. ImageTypePng = "png" // ImageTypeBmp is type of BMP. ImageTypeBmp = "bmp" // ImageTypeTiff is type of TIFF. ImageTypeTiff = "tiff" )
Variables ¶
View Source
var ( ErrInvalidImageType = errors.New("invalid image type") ErrImageSizeExceeded = errors.New("image size exceeded") ErrImageDecodeConfig = errors.New("failed to decode image config") ErrImageReadRemaining = errors.New("failed to read remaining image data") )
Sentinel errors for image validation.
View Source
var ErrInvalidStorageKey = errors.New("invalid storage key")
ErrInvalidStorageKey is returned when a storage key contains path traversal.
Functions ¶
This section is empty.
Types ¶
type ImageValidator ¶
type ImageValidator struct {
// contains filtered or unexported fields
}
ImageValidator struct.
func NewImageValidator ¶
func NewImageValidator(imagetype []string, maxwidth, maxheight, maxfilesize int) *ImageValidator
NewImageValidator creates a new ImageValidator.
type StorageKeyValidator ¶ added in v1.11.3
type StorageKeyValidator struct{}
StorageKeyValidator validates storage keys for path traversal attacks.
func NewStorageKeyValidator ¶ added in v1.11.3
func NewStorageKeyValidator() *StorageKeyValidator
NewStorageKeyValidator creates a new StorageKeyValidator.
func (*StorageKeyValidator) Validate ¶ added in v1.11.3
func (v *StorageKeyValidator) Validate(key string) error
Validate checks that the given key does not contain path traversal sequences.
Click to show internal directories.
Click to hide internal directories.