Fix empty email destination at cronjob#650
Open
mchehab wants to merge 4 commits into
Open
Conversation
This will need to be part of our release procedure going forward. Signed-off-by: Stephen Finucane <stephen@that.guru>
Preformatted content must not be indented because any space is kept in the output, making the content wrongly indented. When aligning message headers to the left, the new HTML code has been indented including some preformatted content indented with two spaces. The fix is to remove the indent of the content. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Fixes: fe34ab2 ("patch-detail: left align message headers") Reviewed-by: Robin Jarry <robin@jarry.cc> Reviewed-by: Stephen Finucane <stephen@that.guru> (cherry picked from commit 13bbc0d)
Signed-off-by: Stephen Finucane <stephen@that.guru>
On Django 3:3.2.19, if recipient is not filled or is invalid, cron
job fails with:
Traceback (most recent call last):
File "/usr/local/patchwork/./manage.py", line 17, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/patchwork/patchwork/management/commands/cron.py", line 19, in handle
errors = send_notifications()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/patchwork/patchwork/notifications.py", line 84, in send_notifications
message.send()
File "/usr/lib/python3/dist-packages/django/core/mail/message.py", line 284, in send
return self.get_connection(fail_silently).send_messages([self])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 109, in send_messages
sent = self._send(message)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 122, in _send
recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 122, in <listcomp>
recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/message.py", line 99, in sanitize_address
address_parts = nm + localpart + domain
~~~^~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
As there's no point trying to send a notification to an invalid
e-mail, just drops it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If recipient is not filled or is invalid, email submission cronjob crashes with:
Traceback (most recent call last):
File "/usr/local/patchwork/./manage.py", line 17, in
execute_from_command_line(sys.argv)
File "/usr/lib/python3/dist-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/usr/lib/python3/dist-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/patchwork/patchwork/management/commands/cron.py", line 19, in handle
errors = send_notifications()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/patchwork/patchwork/notifications.py", line 84, in send_notifications
message.send()
File "/usr/lib/python3/dist-packages/django/core/mail/message.py", line 284, in send
return self.get_connection(fail_silently).send_messages([self])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 109, in send_messages
sent = self._send(message)
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 122, in _send
recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/backends/smtp.py", line 122, in
recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/django/core/mail/message.py", line 99, in sanitize_address
address_parts = nm + localpart + domain
~~~^~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str
As there's no point trying to send a notification to an invalid e-mail, just drops it.