Skip to content

Commit

Permalink
Merge pull request #1489 from GSA/census_fix
Browse files Browse the repository at this point in the history
fix census BOM error
  • Loading branch information
stvnrlly authored Dec 18, 2024
2 parents 3127e71 + 1a5e882 commit 5a6980f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/aws/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,12 @@ def extract_phones(job):
phone_index = 0
for item in first_row:
# Note: may contain a BOM and look like \ufeffphone number
if item.lower() in ["phone number", "\\ufeffphone number"]:
if item.lower() in [
"phone number",
"\\ufeffphone number",
"\\ufeffphone number\n",
"phone number\n",
]:
break
phone_index = phone_index + 1

Expand Down
14 changes: 14 additions & 0 deletions tests/app/aws/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,20 @@ def test_get_s3_file_makes_correct_call(notify_api, mocker):
2,
"5555555552",
),
(
# simulate file saved with utf8withbom
"\\ufeffPHONE NUMBER\n",
"eee",
2,
"5555555552",
),
(
# simulate file saved without utf8withbom
"\\PHONE NUMBER\n",
"eee",
2,
"5555555552",
),
],
)
def test_get_phone_number_from_s3(
Expand Down

0 comments on commit 5a6980f

Please sign in to comment.