Keep a side computed for a size with one side 0 at 1 or more (closes #283) #291

Merged
clawbot merged 6 commits from issue-283-computed-side-at-least-1 into next 2026-10-16 04:18:00 +02:00
Showing only changes of commit 0eaad0a3f9 - Show all commits
+3 -1
View File
@@ -29,7 +29,9 @@ var (
const MaxDimension = imageprocessor.MaxOutputDimension
// ValidateDimension checks one requested width or height; name ("width" or
// "height") appears in the error. 0 means "original size" and is valid.
// "height") appears in the error. 0 is valid: that side is then worked out from
// the source's proportions and the other requested side, rounded down but at
// least 1, or is the source's own side when the other side is 0 too.
func ValidateDimension(name string, value int) error {
if value < 0 {
return fmt.Errorf("%w: %s is negative", ErrInvalidSize, name)