mirror of
https://github.com/octoleo/syncthing.git
synced 2025-04-02 15:51:51 +00:00
lib/api: Missing error handling in API delete-device (#7494)
This commit is contained in:
parent
6e5514419d
commit
f39477bbd5
@ -187,6 +187,10 @@ func (c *configMuxBuilder) registerDevice(path string) {
|
|||||||
|
|
||||||
c.Handle(http.MethodDelete, path, func(w http.ResponseWriter, _ *http.Request, p httprouter.Params) {
|
c.Handle(http.MethodDelete, path, func(w http.ResponseWriter, _ *http.Request, p httprouter.Params) {
|
||||||
id, err := protocol.DeviceIDFromString(p.ByName("id"))
|
id, err := protocol.DeviceIDFromString(p.ByName("id"))
|
||||||
|
if err != nil {
|
||||||
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
return
|
||||||
|
}
|
||||||
waiter, err := c.cfg.RemoveDevice(id)
|
waiter, err := c.cfg.RemoveDevice(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
http.Error(w, err.Error(), http.StatusBadRequest)
|
http.Error(w, err.Error(), http.StatusBadRequest)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user