mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
Move code that escapes special chars to helper function and use it
in query get_users_by_partial_email
This commit is contained in:
@@ -115,3 +115,12 @@ def last_n_days(limit_days):
|
||||
# reverse the countdown, -1 from first two args to ensure it stays 0-indexed
|
||||
for x in range(limit_days - 1, -1, -1)
|
||||
]
|
||||
|
||||
|
||||
def escape_special_characters(string):
|
||||
for special_character in ('\\', '_', '%', '/'):
|
||||
string = string.replace(
|
||||
special_character,
|
||||
'\{}'.format(special_character)
|
||||
)
|
||||
return string
|
||||
|
||||
Reference in New Issue
Block a user