1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

Allow empty optional arguments

This commit is contained in:
DarthSim 2018-10-03 21:33:22 +06:00
parent 06662561fa
commit 9e131b9b79

View File

@ -182,19 +182,19 @@ func applySizeOption(po *processingOptions, args []string) (err error) {
return fmt.Errorf("Invalid size arguments: %v", args)
}
if len(args) >= 1 {
if len(args) >= 1 && len(args[0]) > 0 {
if err = applyWidthOption(po, args[0:1]); err != nil {
return
}
}
if len(args) >= 2 {
if len(args) >= 2 && len(args[1]) > 0 {
if err = applyHeightOption(po, args[1:2]); err != nil {
return
}
}
if len(args) == 3 {
if len(args) == 3 && len(args[2]) > 0 {
if err = applyEnlargeOption(po, args[2:3]); err != nil {
return
}