diff options
Diffstat (limited to 'bskyweb/cmd/embedr/handlers.go')
-rw-r--r-- | bskyweb/cmd/embedr/handlers.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bskyweb/cmd/embedr/handlers.go b/bskyweb/cmd/embedr/handlers.go index 5fee7f3a0..a3767eeca 100644 --- a/bskyweb/cmd/embedr/handlers.go +++ b/bskyweb/cmd/embedr/handlers.go @@ -122,14 +122,20 @@ func (srv *Server) WebOEmbed(c echo.Context) error { } // TODO: do we actually do something with width? - width := 550 + width := 600 maxWidthParam := c.QueryParam("maxwidth") if maxWidthParam != "" { maxWidthInt, err := strconv.Atoi(maxWidthParam) - if err != nil || maxWidthInt < 220 || maxWidthInt > 550 { - return c.String(http.StatusBadRequest, "Invalid maxwidth (expected integer between 220 and 550)") + if err != nil { + return c.String(http.StatusBadRequest, "Invalid maxwidth (expected integer)") + } + if maxWidthInt < 220 { + width = 220 + } else if maxWidthInt > 600 { + width = 600 + } else { + width = maxWidthInt } - width = maxWidthInt } // NOTE: maxheight ignored |