Fix string formatting in email ID construction for consistency
Browse files- app/controllers/mail.py +2 -2
app/controllers/mail.py
CHANGED
@@ -166,7 +166,7 @@ def list_emails(service, messages):
|
|
166 |
},
|
167 |
)
|
168 |
)
|
169 |
-
ids.append(f"{metadata[
|
170 |
if os.path.exists(path):
|
171 |
os.remove(path)
|
172 |
for index, document in enumerate(attach_docs or []):
|
@@ -181,7 +181,7 @@ def list_emails(service, messages):
|
|
181 |
}
|
182 |
document.metadata.update(metadata)
|
183 |
documents.append(document)
|
184 |
-
ids.append(f"{metadata[
|
185 |
elif msg["payload"]["mimeType"] == "text/plain" and "data" in msg["payload"]["body"]:
|
186 |
body = base64.urlsafe_b64decode(msg["payload"]["body"]["data"]).decode("utf-8")
|
187 |
body = re.sub(r"<[^>]+>", "", body)
|
|
|
166 |
},
|
167 |
)
|
168 |
)
|
169 |
+
ids.append(f"{metadata['msg_id']}_{part['filename']}")
|
170 |
if os.path.exists(path):
|
171 |
os.remove(path)
|
172 |
for index, document in enumerate(attach_docs or []):
|
|
|
181 |
}
|
182 |
document.metadata.update(metadata)
|
183 |
documents.append(document)
|
184 |
+
ids.append(f"{metadata['msg_id']}_{part['filename']}_{index}")
|
185 |
elif msg["payload"]["mimeType"] == "text/plain" and "data" in msg["payload"]["body"]:
|
186 |
body = base64.urlsafe_b64decode(msg["payload"]["body"]["data"]).decode("utf-8")
|
187 |
body = re.sub(r"<[^>]+>", "", body)
|