[#5783] Improve resilience to unparsable outlook attachments#5920
Merged
[#5783] Improve resilience to unparsable outlook attachments#5920
Conversation
We try to minimise what we load in `script/handle-mail-replies` as it's run pretty frequently, so we want to avoid memory capacity problems. This commit does some minor cleanup to group the addition of a directory to the load path, the requires for the files under that load path, and any code called directly from the require. This is to make a future change easier. I've also cleaned up quote style.
Sometimes we receive messages with outlook attachments that can't be parsed due to an issue in mapi [1]. There's a potential fix [2] but it conflicts [3] with an existing patch we apply [4]. This at least allows users to download the raw attachment, rather than us preventing the entire request from loading because we raise an exception. It's not easy to include an attachment in the specs to replicate a real error case due to the complexity of removing PII, so I've just stubbed the call to `.open` as we don't care about the specifics in this spec. `script/handle-mail-replies` needs an explicit require as we minimise the load path for that script. Part of #5783. [1] aquasync/ruby-msg#15 [2] aquasync/ruby-msg#16 [3] #5783 (comment) [4] mysociety/ruby-msg#3
2c6597b to
edd9c9c
Compare
Fixes RuboCop warning.
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.
Sometimes we receive messages with outlook attachments that can't be
parsed due to an issue in mapi [1].
There's a potential fix [2] but it conflicts [3] with an existing patch
we apply [4].
This at least allows users to download the raw attachment, rather than
us preventing the entire request from loading because we raise an
exception.
Part of #5783.
[1] aquasync/ruby-msg#15
[2] aquasync/ruby-msg#16
[3] #5783 (comment)
[4] mysociety/ruby-msg#3
Notes to reviewer
We actually rely on
$alaveteli_dirin this case, as we use it inMailHandler::ReplyHandler.load_rails.