Skip to content

Commit

Permalink
Adds escaping for - sign as well (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
vmesel authored Dec 11, 2023
1 parent bffe36a commit 224f574
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions target_salesforce_v3/sinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,11 @@ def preprocess_record(self, record, context):
# Try to find object instance
if record.get("Email"):
email_to_check = record.get("Email")
if "+" in email_to_check:
email_to_check = email_to_check.replace("+", "\+")

# Escape special characters on email
for char in ["+", "-"]:
if char in email_to_check:
email_to_check = email_to_check.replace(char, f"\{char}")

query = "".join(["FIND {", email_to_check, "} ", f" IN ALL FIELDS RETURNING {object_type}(id)"])
req = self.request_api("GET", "search/", params={"q": query})
Expand Down

0 comments on commit 224f574

Please sign in to comment.