if sel := query.Get("select"); sel != "" { switch sel { case "refresh": if prefix { return BadRequest("cannot use 'name' with 'select=refresh'") } if q != "" { return BadRequest("cannot use 'q' with 'select=refresh'") } return storeUpdates(c, r, user) case "private": private = true
}
}
The relevant part of the code is (daemon/api.go):
query := r.URL.Query() "section" )
q := query.Get("q")
section := query.Get(
name := query.Get("name")
private := false
prefix := false
if name != "" {
return BadRequest("cannot use 'q' and 'name' together")
if q != "" {
}
if name[len(name)-1] != '*' {
return findOne(c, r, user, name)
}
q = name[:len(name)-1]
}
if sel := query.Get( "select" ); sel != "" {
switch sel {
case "refresh":
if prefix {
return BadRequest("cannot use 'name' with 'select=refresh'")
}
if q != "" {
return BadRequest("cannot use 'q' with 'select=refresh'")
}
return storeUpdates(c, r, user)
case "private":
private = true
}
}
theStore := getStore(c) Find(&store. Search{
Query: q,
Section: section,
Private: private,
Prefix: prefix,
found, err := theStore.
}, user)
The main issue seems to be if you pass ?name=&select= no BadRequest is generated because the function returns after findOne().
Also note the 'section' parameter is not documented in https:/ /github. com/snapcore/ snapd/wiki/ REST-API