From c1003e8afcf464740397e4d16bbc570e85f547d2 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 16 Jul 2024 16:03:21 +0200 Subject: [PATCH] fixing bad tag value handler --- changedetectionio/flask_app.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/changedetectionio/flask_app.py b/changedetectionio/flask_app.py index eae4f85e..1105f91a 100644 --- a/changedetectionio/flask_app.py +++ b/changedetectionio/flask_app.py @@ -766,6 +766,11 @@ def changedetection_app(config=None, datastore_o=None): datastore.data['watching'][uuid].update(form.data) datastore.data['watching'][uuid].update(extra_update_obj) + if not datastore.data['watching'][uuid].get('tags'): + # Force it to be a list, because form.data['tags'] will be string if nothing found + # And del(form.data['tags'] ) wont work either for some reason + datastore.data['watching'][uuid]['tags'] = [] + # Recast it if need be to right data Watch handler watch_class = get_custom_watch_obj_for_processor(form.data.get('processor')) datastore.data['watching'][uuid] = watch_class(datastore_path=datastore_o.datastore_path, default=datastore.data['watching'][uuid]) @@ -1548,6 +1553,10 @@ def changedetection_app(config=None, datastore_o=None): for uuid in uuids: uuid = uuid.strip() if datastore.data['watching'].get(uuid): + # Bug in old versions caused by bad edit page/tag handler + if isinstance(datastore.data['watching'][uuid]['tags'], str): + datastore.data['watching'][uuid]['tags'] = [] + datastore.data['watching'][uuid]['tags'].append(tag_uuid) flash(f"{len(uuids)} watches were tagged")