| Commit message (Collapse) | Author | Age | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ruby can natively decode uuencoded text with String#unpack. [1] This
avoids the uuencode program dependency and avoids writing tempfiles.
The actual implementation is taken from mail [2]. The UnixToUnix module
is not available in our bundled version of mail.
This commit includes a spec to illustrate the failure of uuencode(1) to
decode the particular attachment in incoming-request-bad-uuencoding-2.
email. Parsing with uuencode returns the following error:
External Command: Error from command "uudecode -o /dev/stdout
/tmp/foiuu20150530-14811-u6j936":
uudecode: /tmp/foiuu20150530-14811-u6j936: No `end' line
The file _is_ created and appears to be OK, but the exit code is 1. This
causes AlaveteliExternalCommand to fail and return nil.
See #2508 [3] for the bug report.
[1] http://ruby-doc.org/core-1.8.7/String.html#method-i-unpack
[2] https://github.com/mikel/mail/blob/bc4c9bb9321e9d36a678692f2f562d3146b63f78/lib/mail/encodings/unix_to_unix.rb#L7
[3] https://github.com/mysociety/alaveteli/issues/2508
|
|
|
| |
Inspired by https://github.com/mikel/mail/commit/bc4c9bb9321e9d36a678692f2f562d3146b63f78
|
|
|
|
|
|
|
|
|
|
| |
mb_chars provides a multibyte-aware wrapper for strings. It should
have no effect on ruby 1.9.3 and above. Although ruby 1.8.7 wouldn't
raise errors on a badly sliced multibyte string, on upgrading to ruby
1.9.3 and above, string operations such as gsub, match and join may
produce ArgumentErrors with the message "invalid byte sequence in UTF-8".
Additionally, a database with 'UTF-8' encoding may produce the error
"PG::CharacterNotInRepertoire: ERROR: invalid byte sequence for encoding "UTF8""
|
|
|
|
|
|
|
|
|
|
| |
Seems more logical to make this one method that figures out what to do
based on file type. Plus, incoming message does so many things, it
seemed like having these related methods be separate would make them
easier to read and understand. Also, email, mobile and login
substitution texts weren't being translated. Finally, I think passing
the censor rules and masks as arguments is a first step in some more
decoupling of models.
|
|
|
|
| |
Fixes #1569
|
|
|
|
| |
The code being tested is specific in that way.
|
|\
| |
| |
| | |
'opennewzealand_github/feature/encode-utf8-messages' into rails-3-develop
|
| | |
|
|/
|
|
|
|
|
| |
Just expecting the parsed file to include the expected one would mean
success in the case where nothing has been folded. Tighten up the
expectation, and add quoting placeholders to expected files that didn't
have them.
|
| |
|
| |
|
|
|
|
| |
Move it into the Ability module.
|
| |
|
|
|
|
|
| |
Add a convenience method for getting the 'response' event associated
with an incoming message.
|
| |
|
| |
|
|
|
|
| |
ruby 1.8 by using mb_chars for length comparison - it counts multibyte characters.
|
|\ |
|
| |
| |
| |
| | |
body is only quoted text and there is no subject.
|
| | |
|
|/ |
|
|
|
|
| |
the main part in order to look for uuencoded text, make sure that we're getting that main part from the reparsed attachments, and not getting an obsolete attachment. Fixes #958.
|
|
|
|
|
|
|
|
|
|
|
| |
Under Rails 3, the uudecoded FoiAttachment in this test
fails validation at the self.save! in
IncomingMessage.parse_raw_email, although the FoiAttachment
has been correctly created and saved to the database in
_uudecode_and_save_attachments. Forcing a reload=true on
self.foi_attachments fixes this.
Thanks to Louise Crow for finding the fix for this problem.
|
|
|
|
|
|
|
|
|
|
|
| |
The example file that was used for checking for text
attachment data which could not be converted to UTF-8 is
one that we *can* actually deal with by guessing the
character set, since it's valid GB18030. So, this commit
changes that test to check for the first few Chinese
characters in that email, and introduces a replacement
test with text from /dev/random, which should not be
interpretable in any sensible way.
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
Gemfile
Gemfile.lock
config/environment.rb
lib/i18n_fixes.rb
|
| | |
|
|\|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
Gemfile.lock
Rakefile
app/controllers/request_controller.rb
lib/tasks/rspec.rake
spec/controllers/services_controller_spec.rb
spec/spec_helper.rb
spec/views/request/_after_actions.rhtml_spec.rb
|
| |
| |
| |
| | |
timezone. TMail renders headers using localtime, which is not ideal, but we're migrating away from it anyway, so I'm not sure it's worth delving into the internals of TMail to fix it.
|
|/ |
|
|
|
|
|
|
| |
Conflicts:
lib/mail_handler/backends/tmail_backend.rb
|
|
|
|
| |
get_attachment_text_one_file as it is now an externally-accessed method of the mail handler module.
|
| |
|
|
|
|
|
|
| |
Conflicts:
spec/models/incoming_message_spec.rb
|
| |
|
| |
|
|
|
|
| |
handler, use mail handler methods.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
again the use of converted HTML parts in emails means extra leading spaces.
|
|
|
|
| |
pass (we now use the HTML parts of emails by preference, so there are some leading spaces.)
|
|
|
|
| |
anymore. Add a failing spec using it as an example.
|
| |
|
| |
|
| |
|
| |
|