Skip to content

Instantly share code, notes, and snippets.

@borwickatuw
Created January 5, 2023 19:09
Show Gist options
  • Select an option

  • Save borwickatuw/2ed085179708b821a0111cbeb5950df0 to your computer and use it in GitHub Desktop.

Select an option

Save borwickatuw/2ed085179708b821a0111cbeb5950df0 to your computer and use it in GitHub Desktop.
Workaround for _header_value_parser.py when the message ID has brackets in it
--- unpatched.py 2023-01-05 11:07:46.000000000 -0800
+++ email/_header_value_parser.py 2023-01-05 11:07:06.000000000 -0800
@@ -1485,6 +1485,8 @@
"""
obs_local_part = ObsLocalPart()
last_non_ws_was_dot = False
+ if len(value) >= 3 and value[0]=='[' and value[-2]==']':
+ value = value[1:-2] + value[-1]
while value and (value[0]=='\\' or value[0] not in PHRASE_ENDS):
if value[0] == '.':
if last_non_ws_was_dot:
@borwickatuw
Copy link
Author

For whatever reason, microsoft message-IDs tend to have brackets in them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment