From 1ac298f6ff3b3f2538b9dc476943c8dc61b5b8b9 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 10 Jan 2024 12:53:35 -0800 Subject: [PATCH] Fix empty assign_title validation --- src/documents/serialisers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/documents/serialisers.py b/src/documents/serialisers.py index eb0280fbd..ffcfbcc1d 100644 --- a/src/documents/serialisers.py +++ b/src/documents/serialisers.py @@ -1385,9 +1385,9 @@ class WorkflowActionSerializer(serializers.ModelSerializer): ] def validate(self, attrs): - # Empty strings treated as None to avoid unexpected behavior - if "assign_title" in attrs: - if attrs["assign_title"] is not None and len(attrs["assign_title"]) == 0: + if "assign_title" in attrs and attrs["assign_title"] is not None: + if len(attrs["assign_title"]) == 0: + # Empty strings treated as None to avoid unexpected behavior attrs["assign_title"] = None else: try: