From 43d24183777d4d8afd2777e42862c35df8ba118e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 22 Feb 2019 08:22:52 +0100 Subject: [PATCH] Fixes #2486 - Unable to process email on CentOS with large images but only 1px height. --- app/models/store.rb | 20 ++++++-- spec/models/channel/email_parser_spec.rb | 15 ++++++ test/data/image/4000x1.jpg | Bin 0 -> 1738 bytes test/data/image/8000x25.jpg | Bin 0 -> 5510 bytes test/data/image/8000x300.jpg | Bin 0 -> 58623 bytes test/data/mail/mail079.box | 57 +++++++++++++++++++++++ test/unit/store_test.rb | 52 ++++++++++++++++++++- 7 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 test/data/image/4000x1.jpg create mode 100644 test/data/image/8000x25.jpg create mode 100644 test/data/image/8000x300.jpg create mode 100644 test/data/mail/mail079.box diff --git a/app/models/store.rb b/app/models/store.rb index 4827b2c5a..52ed5292e 100644 --- a/app/models/store.rb +++ b/app/models/store.rb @@ -51,11 +51,12 @@ returns data.delete('object') data['preferences'] ||= {} + resizable = false ['Mime-Type', 'Content-Type', 'mime_type', 'content_type'].each do |key| next if data['preferences'][key].blank? next if !data['preferences'][key].match(%r{image/(jpeg|jpg|png)}i) - data['preferences']['resizable'] = true + resizable = true break end @@ -63,14 +64,18 @@ returns store = Store.create!(data) begin - if store.preferences[:resizable] == true + if resizable if store.content_preview(silence: true) + store.preferences[:resizable] = true store.preferences[:content_preview] = true end if store.content_inline(silence: true) + store.preferences[:resizable] = true store.preferences[:content_inline] = true end - store.save! + if store.preferences[:resizable] + store.save! + end end rescue => e logger.error e @@ -291,7 +296,14 @@ returns temp_file.write(content) temp_file.close image = Rszr::Image.load(temp_file.path) - return if image.width < width + + # do not resize image if image is smaller or already same size + return if image.width <= width + + # do not resize image if new height is smaller then 7px (images + # with small height are usally usefull to resize) + ratio = image.width / width + return if image.height / ratio <= 6 image.resize!(width, :auto) temp_file_resize = ::Tempfile.new.path diff --git a/spec/models/channel/email_parser_spec.rb b/spec/models/channel/email_parser_spec.rb index 16412c478..8d771734e 100644 --- a/spec/models/channel/email_parser_spec.rb +++ b/spec/models/channel/email_parser_spec.rb @@ -192,5 +192,20 @@ RSpec.describe Channel::EmailParser, type: :model do end end end + + context 'when mail contains image(s)' do + # see https://github.com/zammad/zammad/issues/2486 + context 'when image is large but not resizable' do + let(:mail_file) { Rails.root.join('test', 'data', 'mail', 'mail079.box') } + + it "doesn't set resizable preference" do + _ticket, article = described_class.new.process({}, raw_mail) + attachment = article.attachments.last + + expect(attachment.filename).to eq('a.jpg') + expect(attachment.preferences).not_to include('resizable' => true) + end + end + end end end diff --git a/test/data/image/4000x1.jpg b/test/data/image/4000x1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..83ea2d8e4c672df00530c5e11ffc6ad49f9ba18b GIT binary patch literal 1738 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%)&rZMU_b4?usLlYAdd38%$3nLpnV-q8g zA&i`yoIKn-61=<;Mv5|uMkIs(2N(o77#R5%Ff%GKFbOg;3o`yc!XVGUz{m>pEy%-A zz{teR!pg?Z!O6u9RIpWmfr*isnTds&m6e4BsJa#?&%h$cDx_%W$R-?^$gWfM%n)zE zeTL>QL7=~wSXh`@*g^hcWGV+@WL#*fx|KhImPA>PE$>Ec9iad&Vc zoTi%@8WULTF9M>uJVHct05_P&N3XpC_5nyZ907+R5eNhdg+ya;n=p!s7)=$`%{Xl> zoo(7$cszk*YCs?w>*4WaOG9Hb3XMk7F<{uxsk=?hY1H*cASe_HqlnSiv`K@ii`S+8 z=UQt5ut-2t#}ly1=my4 z(lat|WaZx~xLsIur?{k|vZ}hKwyyqOORKQ$(PL42M_<4A+4C2Ymjk0?ugBj^O#b}K z+xdm}AEb*PmzG!7xgY@eC)Ovje{f-CTnbPq2t}-OK@?(S4Pv1%T?$;q&I1t;p-QAC zAaV97dF9P0J#)`FwZO<;v^t44sz1Mu_6OO&155m0WS_wP<{AJnAVju25DV-DmRFO> zxeD@@XCQZA<2g{2)A9D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0E+<@1OE>hVACjA#b}|94QD%aF~a zeWxE?*Pu{QD0CH0y&wsmUSJeZ_(Q!&(Ok{e)N;lNQ{nHRRjzr?98>(%%_`xvGmh^4 zFEJxcFJeJUK7+#k`R(CJrUcnbXCGF$Pw)c*J(qYl%L4y71`2l9qD4hFUEZ&Dvn3CE zB?+|HNsQ(8WVf5;F3(gO#K{<*U(L!0gqX=yKMbWL0lyF#3)<;!bxyl#>wZM6?yXHS zEb-Zx8M3;0UTR-9QZ%NK-~DLBCJM^|yqu0HeSh8xC7|YfvHGjJ!{pIgM49CVA69K_ z3$16-sBBTd=wDf6THL*H7jrKwVzT(J$nDRXuhpm`S`XF8YhlIc|9zfmVcBDtZI_V$ z<5`jX*9T}?*{e9=z7&ht1O>031z{%AyRQiPZu@$~3z!;z+ryUivD8kai3>GW5;(OG$&42P`_^QnpD7bhKbo>>;X_vj^WB{#jo*9|8d!J?zGs@(@xS>zvq?znv4nP z@Szirbgo%B#M6{J1CLzvMTj=8r@l5$ln-A5M}%*7czPQ`%Ey_*S<+$bjiZ~5Iqx;(4=i8Hq;r))$_7y zV_CU76#CNanUSV&O9joVOJJl@zpVezO`t-{#?kdj(~h1#XEmwg=zDR+v#;x1 zwy`ei9}`>LbvblgyEPwrQmMknss3ZUja(Ah@T-(h~s9*h$kIi5rSniPic(4C`Se}d*ysm3T zfGjyYrE6a#HLo;eU$Nym^RgoV5KZ$l{ aSPZZjU@^dAfW-id0Tu)QH3p#HC;kOCrl)xT literal 0 HcmV?d00001 diff --git a/test/data/mail/mail079.box b/test/data/mail/mail079.box new file mode 100644 index 000000000..a7f1e83cc --- /dev/null +++ b/test/data/mail/mail079.box @@ -0,0 +1,57 @@ +Return-Path: +X-Original-To: me@example.net +Delivered-To: martin@example.de +Received: from mx2.example.com (mx2.example.com [127.0.0.1]) + by base.example.de (Postfix) with ESMTPS id 69D861E933 + for ; Wed, 20 Feb 2019 19:49:59 +0100 (CET) +From: Martin Smith +Content-Type: multipart/alternative; + boundary="Apple-Mail=_E3889AFD-C5DA-47A3-86E6-3E59CB07002D" +Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) +Subject: image resize test +Message-Id: <3271C0D7-9FD0-4E93-925E-87B139DB6FBF@example.com> +Date: Wed, 20 Feb 2019 19:50:00 +0100 +To: Martin Smith + + +--Apple-Mail=_E3889AFD-C5DA-47A3-86E6-3E59CB07002D +Content-Transfer-Encoding: 7bit +Content-Type: text/plain; + charset=us-ascii + +image resize test + + + +the end +--Apple-Mail=_E3889AFD-C5DA-47A3-86E6-3E59CB07002D +Content-Type: multipart/related; + type="text/html"; + boundary="Apple-Mail=_113961F0-41B5-43D3-BF74-8B0DE1B757A4" + + +--Apple-Mail=_113961F0-41B5-43D3-BF74-8B0DE1B757A4 +Content-Transfer-Encoding: 7bit +Content-Type: text/html; + charset=us-ascii + +image resize test


the end
+--Apple-Mail=_113961F0-41B5-43D3-BF74-8B0DE1B757A4 +Content-Transfer-Encoding: base64 +Content-Disposition: inline; + filename=a.jpg +Content-Type: image/jpeg; + x-unix-mode=0600; + name="a.jpg" +Content-Id: <5EF92182-3261-44C7-9835-E8A922AB4976@openvpn> + +/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIf +IiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/wAALCAABAlgBAREA/8QAHwAAAQUBAQEB +AQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1Fh +ByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZ +WmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXG +x8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEBAAA/APZKKKKKKKKKKKKKKKKK +KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK//2Q== +--Apple-Mail=_113961F0-41B5-43D3-BF74-8B0DE1B757A4-- + +--Apple-Mail=_E3889AFD-C5DA-47A3-86E6-3E59CB07002D-- diff --git a/test/unit/store_test.rb b/test/unit/store_test.rb index 92b8657fc..e91120354 100644 --- a/test/unit/store_test.rb +++ b/test/unit/store_test.rb @@ -248,7 +248,7 @@ class StoreTest < ActiveSupport::TestCase image = Rszr::Image.load(temp_file) assert_equal(image.width, 200) - # possible (now preview or inline needed) + # no preview or inline needed store = Store.add( object: 'SomeObject5', o_id: rand(1_234_567_890), @@ -260,7 +260,7 @@ class StoreTest < ActiveSupport::TestCase }, created_by_id: 1, ) - assert_equal(store.preferences[:resizable], true) + assert_nil(store.preferences[:resizable]) assert_nil(store.preferences[:content_inline]) assert_nil(store.preferences[:content_preview]) assert_raises(RuntimeError) do @@ -270,5 +270,53 @@ class StoreTest < ActiveSupport::TestCase store.content_preview end + # no preview or inline needed + store = Store.add( + object: 'SomeObject6', + o_id: rand(1_234_567_890), + data: File.binread(Rails.root.join('test', 'data', 'image', '4000x1.jpg')), + filename: 'test1.jpg', + preferences: { + content_type: 'image/jpg', + content_id: 234, + }, + created_by_id: 1, + ) + assert_nil(store.preferences[:resizable]) + assert_nil(store.preferences[:content_inline]) + assert_nil(store.preferences[:content_preview]) + + # possible (no preview or inline needed) + store = Store.add( + object: 'SomeObject7', + o_id: rand(1_234_567_890), + data: File.binread(Rails.root.join('test', 'data', 'image', '8000x25.jpg')), + filename: 'test1.jpg', + preferences: { + content_type: 'image/jpg', + content_id: 234, + }, + created_by_id: 1, + ) + assert_nil(store.preferences[:resizable]) + assert_nil(store.preferences[:content_inline]) + assert_nil(store.preferences[:content_preview]) + + # possible (preview and inline) + store = Store.add( + object: 'SomeObject8', + o_id: rand(1_234_567_890), + data: File.binread(Rails.root.join('test', 'data', 'image', '8000x300.jpg')), + filename: 'test1.jpg', + preferences: { + content_type: 'image/jpg', + content_id: 234, + }, + created_by_id: 1, + ) + assert_equal(store.preferences[:resizable], true) + assert_equal(store.preferences[:content_inline], true) + assert_equal(store.preferences[:content_preview], true) + end end