fix BOM issue again

This commit is contained in:
Kenneth Kehl
2025-01-03 12:27:00 -08:00
parent 5f0dd6af50
commit 0f52efd742

View File

@@ -402,12 +402,7 @@ def extract_phones(job):
phone_index = 0 phone_index = 0
for item in first_row: for item in first_row:
# Note: may contain a BOM and look like \ufeffphone number # Note: may contain a BOM and look like \ufeffphone number
if item.lower() in [ if item.lower().lstrip("\ufeff") == "phone number":
"phone number",
"\\ufeffphone number",
"\\ufeffphone number\n",
"phone number\n",
]:
break break
phone_index = phone_index + 1 phone_index = phone_index + 1
@@ -419,7 +414,8 @@ def extract_phones(job):
if phone_index >= len(row): if phone_index >= len(row):
phones[job_row] = "Unavailable" phones[job_row] = "Unavailable"
current_app.logger.error( current_app.logger.error(
"Corrupt csv file, missing columns or possibly a byte order mark in the file", f"Corrupt csv file, missing columns or\
possibly a byte order mark in the file, row looks like {row}",
) )
else: else: