mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-16 09:36:18 +02:00
Fix width & height checking
This commit is contained in:
@@ -110,7 +110,7 @@ func applyWidthOption(po *processingOptions, args []string) error {
|
||||
return fmt.Errorf("Invalid width arguments: %v", args)
|
||||
}
|
||||
|
||||
if w, err := strconv.Atoi(args[0]); err == nil || w >= 0 {
|
||||
if w, err := strconv.Atoi(args[0]); err == nil && w >= 0 {
|
||||
po.Width = w
|
||||
} else {
|
||||
return fmt.Errorf("Invalid width: %s", args[0])
|
||||
@@ -124,7 +124,7 @@ func applyHeightOption(po *processingOptions, args []string) error {
|
||||
return fmt.Errorf("Invalid height arguments: %v", args)
|
||||
}
|
||||
|
||||
if h, err := strconv.Atoi(args[0]); err == nil || po.Height >= 0 {
|
||||
if h, err := strconv.Atoi(args[0]); err == nil && po.Height >= 0 {
|
||||
po.Height = h
|
||||
} else {
|
||||
return fmt.Errorf("Invalid height: %s", args[0])
|
||||
|
Reference in New Issue
Block a user