Browse Source

Fixes #4874 - Body of emails is squashed (e.g. with Ebay correspondences).

Florian Liebe 1 year ago
parent
commit
82b004282c

+ 0 - 1
app/assets/stylesheets/zammad.scss

@@ -12781,7 +12781,6 @@ output {
 
   table {
     table-layout: auto;
-    display: block;
     width: 100%;
     overflow: auto;
     -webkit-overflow-scrolling: touch;

+ 4 - 1
lib/html_sanitizer/scrubber/wipe.rb

@@ -88,7 +88,10 @@ class HtmlSanitizer
       end
 
       def node_has_css?(node, key)
-        node['style'].present? && node['style']&.include?("#{key}:")
+        return false if node['style'].blank?
+        return false if node['style'].split(';').blank?
+
+        node['style'].split(';').filter_map { |attr| attr.split(':')&.first&.strip }.include?(key)
       end
 
       def node_init_style(node)

+ 7 - 0
spec/lib/html_sanitizer/scrubber/wipe_spec.rb

@@ -49,6 +49,13 @@ RSpec.describe HtmlSanitizer::Scrubber::Wipe do
       it { is_expected.to eq target }
     end
 
+    context 'when has width and max-width attributes' do
+      let(:input)  { '<img width="100px" style="max-width: 600px">' }
+      let(:target) { '<img style="max-width: 600px;width:100px;">' }
+
+      it { is_expected.to eq target }
+    end
+
     context 'when has not allowed attributes' do
       let(:input)  { '<div width="100px" style="color:#ff0000" other="true">test</div>' }
       let(:target) { '<div style="color:#ff0000;">test</div>' }

File diff suppressed because it is too large
+ 0 - 0
test/data/mail/mail043.yml


Some files were not shown because too many files changed in this diff