diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-06-03 11:26:27 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-06-03 11:26:27 +0100 |
commit | 1e8dc7d5cbb382f6cb94716fd1ff0c990d219792 (patch) | |
tree | 3886bb03165172d84a21c85fa7cd6695caaa0001 /lib/no_constraint_disabling.rb | |
parent | cfd737427102f3e8449e6ed46ce768b3c520d387 (diff) |
Use Ruby to decode uuencoded attachments
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
Diffstat (limited to 'lib/no_constraint_disabling.rb')
0 files changed, 0 insertions, 0 deletions