1
0
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:
DarthSim
2018-09-11 17:22:19 +06:00
parent 419f01028e
commit e7e296aa93

View File

@@ -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])