mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Stopped truncating AdminEmailHandler message subjects
Refs #26572, #17281. The RFC doesn't limit total length, just the line length which is already taken care of by Python itself. Thanks Tim Graham for the review.
This commit is contained in:
@@ -128,12 +128,9 @@ class AdminEmailHandler(logging.Handler):
|
||||
|
||||
def format_subject(self, subject):
|
||||
"""
|
||||
Escape CR and LF characters, and limit length.
|
||||
RFC 2822's hard limit is 998 characters per line. So, minus "Subject: "
|
||||
the actual subject must be no longer than 989 characters.
|
||||
Escape CR and LF characters.
|
||||
"""
|
||||
formatted_subject = subject.replace('\n', '\\n').replace('\r', '\\r')
|
||||
return formatted_subject[:989]
|
||||
return subject.replace('\n', '\\n').replace('\r', '\\r')
|
||||
|
||||
|
||||
class CallbackFilter(logging.Filter):
|
||||
|
||||
Reference in New Issue
Block a user