zendesk_apps_support 4.6.0 → 4.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64de3713a3278aa1401945176018eb8251dabe2b
4
- data.tar.gz: 12900df7de9e00ef76386f5f0b8597de02ca2cd1
3
+ metadata.gz: 2606213b113bb33822d480147204c96413ca811f
4
+ data.tar.gz: a75bceb9a99922779a630a6788ef85d6c2ca3556
5
5
  SHA512:
6
- metadata.gz: 5dfa543b1937ef9a1fc90ef04e22bd0e5bee34279512557a0f6e1fbebfdead52c062b7434b259d5127710494d8f95df08cb271a50b4200f92c51f480ff9cdba3
7
- data.tar.gz: a5743c976fb414931c707afc21fffa8137420c5448d9526daff454dabb6c2e04ef767e5c7f96f46828128ac70512b7adac86f41b13823f147beb5601f81fae0b
6
+ metadata.gz: 4065b212cb191878ca73eb4404117d25eb3079fe1635e7f870eff0c92d8db85a7351dcd66bc664e856298c97aef32090d2d95fdabf1f6a13744fa4cebc30d2c7
7
+ data.tar.gz: 37bb13b7f53c1fd2f06dc05b683a4eacd9b0b5976b45442f111afd4ff2e5514ab3f7639316d948748aa1f2e84b50cd1747cf8da12722e65c1e0d5cdd73b251b8
@@ -4,25 +4,32 @@ require 'loofah'
4
4
  module ZendeskAppsSupport
5
5
  module Validations
6
6
  module Svg
7
- @strip_declaration = Loofah::Scrubber.new do |node|
8
- node.remove if node.name == 'xml' && node.children.empty?
9
- end
10
-
11
- @empty_malformed_markup = Loofah::Scrubber.new do |node|
12
- node.next.remove while node.name == 'svg' && node.next
13
- end
7
+ # whitelist elements and attributes used in Zendesk Garden assets
8
+ Loofah::HTML5::WhiteList::ALLOWED_ELEMENTS_WITH_LIBXML2.add 'symbol'
9
+ Loofah::HTML5::WhiteList::ACCEPTABLE_CSS_PROPERTIES.add 'position'
14
10
 
15
11
  # CRUFT: ignore a (very specific) style attribute which Loofah would otherwise scrub.
16
12
  # This attribute is deprecated (https://www.w3.org/TR/filter-effects/#AccessBackgroundImage)
17
13
  # but is included in many of the test apps used in fixtures for tests in ZAM, ZAT etc.
18
- @remove_enable_background = Loofah::Scrubber.new do |node|
19
- match_pattern = Regexp.new("enable-background:.*?(\;|\z)")
14
+ Loofah::HTML5::WhiteList::ACCEPTABLE_CSS_PROPERTIES.add 'enable-background'
15
+
16
+ @strip_declaration = Loofah::Scrubber.new do |node|
17
+ node.remove if node.name == 'xml' && node.children.empty?
18
+ end
19
+
20
+ # Loofah's default scrubber strips spaces between CSS attributes. Passing the input markup through this scrubber
21
+ # first ensures that this stripped whitespace in the output doesn't register as a diff.
22
+ @strip_spaces_between_css_attrs = Loofah::Scrubber.new do |node|
23
+ match_pattern = Regexp.new(/\;\s+/)
20
24
  if node.name == 'svg' && node['style']
21
- node['style'] = node['style'].gsub(match_pattern, '')
22
- node.attributes['style'].remove if node['style'].empty?
25
+ node['style'] = node['style'].gsub(match_pattern, ';')
23
26
  end
24
27
  end
25
28
 
29
+ @empty_malformed_markup = Loofah::Scrubber.new do |node|
30
+ node.next.remove while node.name == 'svg' && node.next
31
+ end
32
+
26
33
  class << self
27
34
  def call(package)
28
35
  errors = []
@@ -30,7 +37,7 @@ module ZendeskAppsSupport
30
37
  package.svg_files.each do |svg|
31
38
  markup = Loofah.xml_fragment(svg.read)
32
39
  .scrub!(@strip_declaration)
33
- .scrub!(@remove_enable_background)
40
+ .scrub!(@strip_spaces_between_css_attrs)
34
41
  .to_xml.strip
35
42
 
36
43
  clean_markup = Loofah.xml_fragment(markup)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk_apps_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 4.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James A. Rosen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-10-19 00:00:00.000000000 Z
14
+ date: 2017-10-20 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: i18n
@@ -273,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  version: 1.3.6
274
274
  requirements: []
275
275
  rubyforge_project:
276
- rubygems_version: 2.6.8
276
+ rubygems_version: 2.6.13
277
277
  signing_key:
278
278
  specification_version: 4
279
279
  summary: Support to help you develop Zendesk Apps.