From f39477bbd57d866daa505185e5c4803338ff0955 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 17 Mar 2021 22:08:44 +0100 Subject: [PATCH] lib/api: Missing error handling in API delete-device (#7494) --- lib/api/confighandler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/api/confighandler.go b/lib/api/confighandler.go index a712a2716..45bc6613d 100644 --- a/lib/api/confighandler.go +++ b/lib/api/confighandler.go @@ -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)