DEV: Update mail and use fork (#10639)

Version 2.8 brings some changes to how address fields are handled and
this commits updates that and should also include a fix which handles
encoded attachment filenames.

The fork contains a bugfix to correctly decode mail attachments.
This commit is contained in:
Bianca Nenciu
2021-02-18 20:15:02 +02:00
committed by GitHub
parent 447ea3f888
commit 3246c3cc92
6 changed files with 86 additions and 28 deletions

View File

@@ -646,6 +646,14 @@ describe Email::Receiver do
MD
end
it "can decode attachments" do
SiteSetting.authorized_extensions = "pdf"
Fabricate(:group, incoming_email: "one@foo.com")
process(:encoded_filename)
expect(Upload.last.original_filename).to eq("This is a test.pdf")
end
context "when attachment is rejected" do
it "sends out the warning email" do
expect { process(:attached_txt_file) }.to change { EmailLog.count }.by(1)

View File

@@ -18,7 +18,7 @@ def EmailFabricator(options)
email += "Cc: #{options[:cc]}\n" if options[:cc]
email += "In-Reply-To: #{options[:in_reply_to]}\n" if options[:in_reply_to]
email += "References: #{options[:in_reply_to]}\n" if options[:in_reply_to]
email += "Message-ID: #{options[:message_id]}\n" if options[:message_id]
email += "Message-ID: <#{options[:message_id]}>\n" if options[:message_id]
email += "Subject: #{options[:subject] || "This is a test email subhect"}\n"
email += "Mime-Version: 1.0\n"
email += "Content-Type: #{options[:content_type] || "text/plain;\n charset=UTF-8"}\n"