Skip to content

Commit

Permalink
fix(cloud): fix email obfuscation (#245)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **Bug Fixes**
- Improved handling of tokens with leading single quotes in data
processing, ensuring correct functionality in regular expression
substitutions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
rokam authored Jul 30, 2024
1 parent fada9bc commit ad9f278
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions midealocal/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ def _redact_data(data: str) -> str:
+ getattr(cr, "street_addresses", [])
)
for token in token_list:
m = len(token)
elm = r"\b" + token + r"\b"
item = token
if len(item) > 0 and item[0] == "'":
item = item[1:]
if len(item) == 0:
break
m = len(item)
elm = r"\b" + item + r"\b"
data = re.sub(elm, block * m, data)
return data

Expand Down

0 comments on commit ad9f278

Please sign in to comment.