diff options
author | Louise Crow <louise.crow@gmail.com> | 2015-04-02 14:45:59 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2015-04-02 14:45:59 +0100 |
commit | 1de541184eaa011123763aba8803896cc6426fc8 (patch) | |
tree | 0f39a01f7fa0e34e9328cf0199315f2923872aa7 | |
parent | d5a51cd73157fc5d15f5b300179b17221fb412a8 (diff) | |
parent | 0a4c99a397e37064704c6706bf9c636d1157dbe2 (diff) |
Merge branch 'hotfix/0.21.0.3' into rails-3-develop
-rw-r--r-- | config/initializers/alaveteli.rb | 2 | ||||
-rw-r--r-- | lib/attachment_to_html/adapters/pdf.rb | 3 | ||||
-rw-r--r-- | spec/lib/attachment_to_html/adapters/pdf_spec.rb | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/config/initializers/alaveteli.rb b/config/initializers/alaveteli.rb index 9ca20eb29..3465f6f4d 100644 --- a/config/initializers/alaveteli.rb +++ b/config/initializers/alaveteli.rb @@ -10,7 +10,7 @@ load "debug_helpers.rb" load "util.rb" # Application version -ALAVETELI_VERSION = '0.21.0.2' +ALAVETELI_VERSION = '0.21.0.3' # Add new inflection rules using the following format # (all these examples are active by default): diff --git a/lib/attachment_to_html/adapters/pdf.rb b/lib/attachment_to_html/adapters/pdf.rb index 3183d1fd0..3c18e9d4a 100644 --- a/lib/attachment_to_html/adapters/pdf.rb +++ b/lib/attachment_to_html/adapters/pdf.rb @@ -42,7 +42,8 @@ module AttachmentToHTML private def parse_body - match = convert.match(/<body[^>]*>(.*?)<\/body>/mi) + conversion = convert + match = conversion ? conversion.match(/<body[^>]*>(.*?)<\/body>/mi) : nil match ? match[1] : '' end diff --git a/spec/lib/attachment_to_html/adapters/pdf_spec.rb b/spec/lib/attachment_to_html/adapters/pdf_spec.rb index f1ae4695c..ceb438be8 100644 --- a/spec/lib/attachment_to_html/adapters/pdf_spec.rb +++ b/spec/lib/attachment_to_html/adapters/pdf_spec.rb @@ -71,6 +71,11 @@ describe AttachmentToHTML::Adapters::PDF do adapter.success?.should be_false end + it 'is not successful if convert returns nil' do + adapter.stub(:convert).and_return(nil) + adapter.success?.should be_false + end + it 'is not successful if the body contains more than 50 images' do # Sometimes pdftohtml extracts images incorrectly, resulting # in thousands of PNGs being created for one image. This creates |