Browse Source

Follow up - 045902351 - fixes #2754

045902351 adds a `rescue` clause
to fix a bug in which IMAP parsing errors
cause the entire email import process to fail.[0]

This bugfix contains an error:
we're still not sure why,
but the `next` inside the `rescue` clause
does not act like the `next`s outside of it
(execution of the containing `.each` block continues,
even after passing `next`).

This commit puts `next` in the right place,
so that the method will skip processing of the current message
and move onto the next one.

[0]: https://github.com/zammad/zammad/issues/2754
Ryan Lue 5 years ago
parent
commit
7a7ab6a95a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      app/models/channel/driver/imap.rb

+ 2 - 1
app/models/channel/driver/imap.rb

@@ -234,9 +234,10 @@ example
         NOTICE
         Rails.logger.error "Net::IMAP failed to parse message #{message_id}: #{e.message} (#{e.class})"
         Rails.logger.error '(See https://github.com/zammad/zammad/issues/2754 for more details)'
-        next
       end
 
+      next if message_meta.nil?
+
       # ignore verify messages
       next if !messages_is_too_old_verify?(message_meta, count, count_all)