embedr: handle out-of-range maxwidth; change default (#3713)
parent
f2797218f8
commit
d81a373d21
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue