From 159eab29c2222c3acf6c6d4c9e182b9f48817a29 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Fri, 26 Feb 2021 13:23:50 +0100 Subject: [PATCH] restrict to named tags --- ereuse_devicehub/resources/tag/view.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ereuse_devicehub/resources/tag/view.py b/ereuse_devicehub/resources/tag/view.py index 2cb3009f..a23c50b1 100644 --- a/ereuse_devicehub/resources/tag/view.py +++ b/ereuse_devicehub/resources/tag/view.py @@ -97,6 +97,10 @@ class TagDeviceView(View): def delete(self, tag_id: str, device_id: str): tag = Tag.from_an_id(tag_id).filter_by(owner=g.user).one() # type: Tag device = Device.query.filter_by(owner=g.user).filter_by(id=device_id).one() + if tag.provider: + # if is an unamed tag not do nothing + return Response(status=204) + if tag.device == device: tag.device_id = None db.session().final_flush()