Skip to content

Commit

Permalink
Merge pull request #59 from DostEducation/fix/57-ignore-attributes-wi…
Browse files Browse the repository at this point in the history
…th-special-characters

Fix/57 Ignore attributes with special characters
  • Loading branch information
Sachinbisht27 authored Jul 1, 2024
2 parents a688bf3 + b84f67c commit c53b8f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/services/user_attribute_service.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from typing import Any

from api import db, models
Expand All @@ -17,6 +18,15 @@ def handle_contact_fields_data(self, contact_data: dict[str, Any]):
self.user_id
)
for field_key, field_value in contact_fields_data.items():
if not re.match(r"^\w+$", field_key):
logger.error(
f"Found a contact variable {field_key} for {self.user_phone} "
"with special character which can't be processed."
)
continue
elif field_key.lower() == "name":
continue

value = field_value.get("value")
user_attribute = existing_attributes.get(field_key)

Expand Down

0 comments on commit c53b8f2

Please sign in to comment.