lib/api: Missing error handling in API delete-device (#7494)

This commit is contained in:
Jakob Borg 2021-03-17 22:08:44 +01:00 committed by GitHub
parent 6e5514419d
commit f39477bbd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -187,6 +187,10 @@ func (c *configMuxBuilder) registerDevice(path string) {
c.Handle(http.MethodDelete, path, func(w http.ResponseWriter, _ *http.Request, p httprouter.Params) {
id, err := protocol.DeviceIDFromString(p.ByName("id"))
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
waiter, err := c.cfg.RemoveDevice(id)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)