Fix URL validation of empty string

This commit is contained in:
shamoon 2023-12-29 00:51:57 -08:00
parent 3861e84f89
commit 05e294fc81

View File

@ -494,7 +494,11 @@ class CustomFieldInstanceSerializer(serializers.ModelSerializer):
"""
data = super().validate(data)
field: CustomField = data["field"]
if field.data_type == CustomField.FieldDataType.URL:
if (
field.data_type == CustomField.FieldDataType.URL
and data["value"] is not None
and len(data["value"]) > 0
):
URLValidator()(data["value"])
return data