aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/incoming_message.rb
diff options
context:
space:
mode:
authorFrancis Irving <francis@mysociety.org>2009-12-01 12:18:17 +0000
committerFrancis Irving <francis@mysociety.org>2009-12-01 12:18:17 +0000
commit9a2f9beeca1cb304c51613e5bf3fdbfe1a94b1a0 (patch)
tree712f43ade93a250f103a0c932f3acaf7a5f02a2c /app/models/incoming_message.rb
parentcd0d1ea8d10a105393ec1e6a9eccaf09c05dfe4d (diff)
Test for PostgreSQL slash escaping bug
http://blog.aradine.com/2009/09/rubys-marshal-and-activerecord-and.html https://rails.lighthouseapp.com/projects/8994/tickets/1063-binary-data-broken-with-postgresql-adapter
Diffstat (limited to 'app/models/incoming_message.rb')
-rw-r--r--app/models/incoming_message.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 3dcbafea9..9b74c9abe 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -893,7 +893,16 @@ class IncomingMessage < ActiveRecord::Base
end
# Returns attachments that are uuencoded in main body part
def get_main_body_text_uudecode_attachments
- text = get_main_body_text_internal
+ # we don't use get_main_body_text_internal, as we want to avoid charset
+ # conversions, since /usr/bin/uudecode needs to deal with those.
+ # e.g. for https://secure.mysociety.org/admin/foi/request/show_raw_email/24550
+ main_part = get_main_body_text_part
+ if main_part.nil?
+ return
+ end
+ text = main_part.body
+ STDERR.puts(text[0..10000])
+ raise "boo"
# Find any uudecoded things buried in it, yeuchly
uus = text.scan(/^begin.+^`\n^end\n/sm)
@@ -907,6 +916,8 @@ class IncomingMessage < ActiveRecord::Base
IO.popen("/usr/bin/uudecode " + tempfile.path + " -o -", "r") do |child|
content = child.read()
end
+ STDERR.puts(tempfile.to_s)
+ raise "stop"
tempfile.close
# Make attachment type from it, working out filename and mime type
attachment = FOIAttachment.new()