aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/change_email_validator.rb2
-rw-r--r--app/models/incoming_message.rb4
-rw-r--r--app/views/request/show_response.rhtml2
-rw-r--r--spec/controllers/user_controller_spec.rb12
-rw-r--r--spec/fixtures/psni.pdfbin0 -> 48057 bytes
-rw-r--r--spec/models/incoming_message_spec.rb7
-rw-r--r--vendor/ruby-msg/lib/mapi/msg.rb6
7 files changed, 26 insertions, 7 deletions
diff --git a/app/models/change_email_validator.rb b/app/models/change_email_validator.rb
index a796489f7..ff7f2f931 100644
--- a/app/models/change_email_validator.rb
+++ b/app/models/change_email_validator.rb
@@ -25,7 +25,7 @@ class ChangeEmailValidator < ActiveRecord::BaseWithoutTable
end
if !errors[:old_email]
- if self.old_email != self.logged_in_user.email
+ if self.old_email.downcase != self.logged_in_user.email.downcase
errors.add(:old_email, "address isn't the same as the address of the account you are logged in with")
elsif !self.logged_in_user.has_this_password?(self.password)
if !errors[:password]
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 949846e69..38d743d18 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -538,7 +538,7 @@ class IncomingMessage < ActiveRecord::Base
uncompressed_text = child.read()
end
# if we managed to uncompress the PDF...
- if !uncompressed_text.nil?
+ if !uncompressed_text.nil? && !uncompressed_text.empty?
# then censor stuff (making a copy so can compare again in a bit)
censored_uncompressed_text = uncompressed_text.dup
self._binary_mask_stuff_internal!(censored_uncompressed_text)
@@ -551,7 +551,7 @@ class IncomingMessage < ActiveRecord::Base
child.close_write()
recompressed_text = child.read()
end
- if !recompressed_text.nil?
+ if !recompressed_text.nil? && !recompressed_text.empty?
text[0..-1] = recompressed_text # [0..-1] makes it change the 'text' string in place
end
end
diff --git a/app/views/request/show_response.rhtml b/app/views/request/show_response.rhtml
index 1d841c3a8..ed32a1b67 100644
--- a/app/views/request/show_response.rhtml
+++ b/app/views/request/show_response.rhtml
@@ -10,7 +10,7 @@
<% if @gone_postal %>
<div class="gone_postal_help">
- <h1>What exactly is happening?</h1>
+ <h1>Which of these is happening?</h1>
<dl>
diff --git a/spec/controllers/user_controller_spec.rb b/spec/controllers/user_controller_spec.rb
index 2bfb35240..193cf476c 100644
--- a/spec/controllers/user_controller_spec.rb
+++ b/spec/controllers/user_controller_spec.rb
@@ -346,6 +346,18 @@ describe UserController, "when changing email address" do
deliveries.size.should == 0
end
+ it "should work even if the old email had a case difference" do
+ @user = users(:bob_smith_user)
+ session[:user_id] = @user.id
+
+ post :signchangeemail, { :signchangeemail => { :old_email => 'BOB@localhost',
+ :password => 'jonespassword', :new_email => 'newbob@localhost' },
+ :submitted_signchangeemail_do => 1
+ }
+
+ response.should render_template('signchangeemail_confirm')
+ end
+
it "should send confirmation email if you get all the details right" do
@user = users(:bob_smith_user)
session[:user_id] = @user.id
diff --git a/spec/fixtures/psni.pdf b/spec/fixtures/psni.pdf
new file mode 100644
index 000000000..daca3f4ec
--- /dev/null
+++ b/spec/fixtures/psni.pdf
Binary files differ
diff --git a/spec/models/incoming_message_spec.rb b/spec/models/incoming_message_spec.rb
index 411aa1d96..f41dff06d 100644
--- a/spec/models/incoming_message_spec.rb
+++ b/spec/models/incoming_message_spec.rb
@@ -174,6 +174,13 @@ describe IncomingMessage, " when censoring data" do
masked_text.should match(/xxx@xxx.xxx.xx/)
end
+ it "should not produce zero length output if pdftk silently fails" do
+ orig_pdf = load_file_fixture('psni.pdf')
+ pdf = orig_pdf.dup
+ @im.binary_mask_stuff!(pdf, "application/pdf")
+ pdf.should_not == ""
+ end
+
it "should apply censor rules to HTML files" do
data = @test_data.dup
@im.html_mask_stuff!(data)
diff --git a/vendor/ruby-msg/lib/mapi/msg.rb b/vendor/ruby-msg/lib/mapi/msg.rb
index c7cfb5515..fc30a9170 100644
--- a/vendor/ruby-msg/lib/mapi/msg.rb
+++ b/vendor/ruby-msg/lib/mapi/msg.rb
@@ -173,7 +173,7 @@ module Mapi
# parse guids
# this is the guids for named properities (other than builtin ones)
# i think PS_PUBLIC_STRINGS, and PS_MAPI are builtin.
- guids = [PS_PUBLIC_STRINGS] + guids_obj.read.scan(/.{16}/m).map do |str|
+ guids = [PS_PUBLIC_STRINGS] + guids_obj.read.scan(/.{16}/mn).map do |str|
Ole::Types.load_guid str
end
@@ -187,7 +187,7 @@ module Mapi
# parse actual props.
# not sure about any of this stuff really.
# should flip a few bits in the real msg, to get a better understanding of how this works.
- props = props_obj.read.scan(/.{8}/m).map do |str|
+ props = props_obj.read.scan(/.{8}/mn).map do |str|
flags, offset = str[4..-1].unpack 'v2'
# the property will be serialised as this pseudo property, mapping it to this named property
pseudo_prop = 0x8000 + offset
@@ -253,7 +253,7 @@ module Mapi
unless (pad == 0 || pad == 8) and data[0...pad] == "\000" * pad
Log.warn "padding was not as expected #{pad} (#{data.length}) -> #{data[0...pad].inspect}"
end
- data[pad..-1].scan(/.{16}/m).each do |data|
+ data[pad..-1].scan(/.{16}/mn).each do |data|
property, encoding = ('%08x' % data.unpack('V')).scan /.{4}/
key = property.hex
# doesn't make any sense to me. probably because its a serialization of some internal