0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

omit empty quality from option string

This commit is contained in:
Will Norris 2015-05-11 19:29:25 -07:00
parent b1de3a9dd6
commit 5d8b630ff2
2 changed files with 4 additions and 2 deletions

View file

@ -80,7 +80,9 @@ func (o Options) String() string {
if o.FlipHorizontal {
fmt.Fprintf(buf, ",%s", optFlipHorizontal)
}
fmt.Fprintf(buf, ",%s%d", string(optQualityPrefix), o.Quality)
if o.Quality != 0 {
fmt.Fprintf(buf, ",%s%d", string(optQualityPrefix), o.Quality)
}
return buf.String()
}

View file

@ -26,7 +26,7 @@ func TestOptions_String(t *testing.T) {
}{
{
emptyOptions,
"0x0,q0",
"0x0",
},
{
Options{1, 2, true, 90, true, true, 80},