aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/incoming_message.rb13
-rw-r--r--spec/models/raw_email_spec.rb25
-rw-r--r--todo.txt6
3 files changed, 43 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()
diff --git a/spec/models/raw_email_spec.rb b/spec/models/raw_email_spec.rb
new file mode 100644
index 000000000..65780baed
--- /dev/null
+++ b/spec/models/raw_email_spec.rb
@@ -0,0 +1,25 @@
+require File.dirname(__FILE__) + '/../spec_helper'
+
+describe User, "manipulating a raw email" do
+ before do
+ @raw_email = RawEmail.new
+ end
+
+ it 'putting data in comes back out' do
+ @raw_email.data = "Hello, world!"
+ @raw_email.save!
+ @raw_email.reload
+ @raw_email.data.should == "Hello, world!"
+ end
+
+ it 'putting data in comes back out even if it has a backslash in it' do
+ @raw_email.data = "This \\ that"
+ @raw_email.save!
+ @raw_email.reload
+ STDERR.puts @raw_email.data
+ STDERR.puts "This \\ that"
+ @raw_email.data.should == "This \\ that"
+ end
+
+end
+
diff --git a/todo.txt b/todo.txt
index 9b1a02adb..bfc265e33 100644
--- a/todo.txt
+++ b/todo.txt
@@ -1,3 +1,9 @@
+Segmentation fault:
+IncomingMessage.find(24705).info_equest_events[0].search_text_main(true)
+
+s = IncomingMessage.find(2); text = s.get_main_body_text_internal; s.cached_main_body_text = text; s.save!
+
+
overdue
date_response_required_by
waiting_response_overdue => waiting_response_slow, waiting_response_overdue