web/api/v1: fix optional skip_head for snapshot (#4674)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
parent
7225919760
commit
3c00eeaf16
|
@ -892,9 +892,15 @@ func (api *API) snapshot(r *http.Request) (interface{}, *apiError, func()) {
|
|||
if !api.enableAdmin {
|
||||
return nil, &apiError{errorUnavailable, errors.New("Admin APIs disabled")}, nil
|
||||
}
|
||||
skipHead, err := strconv.ParseBool(r.FormValue("skip_head"))
|
||||
if err != nil {
|
||||
return nil, &apiError{errorUnavailable, fmt.Errorf("unable to parse boolean 'skip_head' argument: %v", err)}, nil
|
||||
var (
|
||||
skipHead bool
|
||||
err error
|
||||
)
|
||||
if r.FormValue("skip_head") != "" {
|
||||
skipHead, err = strconv.ParseBool(r.FormValue("skip_head"))
|
||||
if err != nil {
|
||||
return nil, &apiError{errorUnavailable, fmt.Errorf("unable to parse boolean 'skip_head' argument: %v", err)}, nil
|
||||
}
|
||||
}
|
||||
|
||||
db := api.db()
|
||||
|
|
Loading…
Reference in New Issue