-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always start with the unmasked attachment body when applying the masks and censor rules. We're going to make changes which mean `FoiAttachment#body` will return masked body, fetch this with `default_body` could result in attachment with old or superseded censor rules still applied. Needed to force HTML attachment into CRLF line endings due to an issue with the mail gem which results in a different hexdigest after rebuilding the raw emails from a file on disk in the specs. Once mikel/mail#1512 is merged we can revert the FoiAttachment factory change.
- Loading branch information
Showing
11 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -406,4 +406,29 @@ | |
to eq(['[email protected]']) | ||
end | ||
end | ||
|
||
describe 'attachment_body_for_hexdigest' do | ||
let(:mail) do | ||
Mail.new do | ||
add_file filename: 'file.txt', content: 'hereisthetext' | ||
end | ||
end | ||
|
||
context 'matching hexdigest' do | ||
it 'returns the body of the attachment' do | ||
body = attachment_body_for_hexdigest( | ||
mail, hexdigest: Digest::MD5.hexdigest('hereisthetext') | ||
) | ||
|
||
expect(body).to eq('hereisthetext') | ||
end | ||
end | ||
|
||
context 'non-matching hexdigest' do | ||
it 'returns nil' do | ||
body = attachment_body_for_hexdigest(mail, hexdigest: 'incorrect') | ||
expect(body).to be_nil | ||
end | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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