maremma 4.2.3 → 4.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 314ffe1024407f3640021c859c332ecfefed5e427049fa7536fff73ee628e59f
4
- data.tar.gz: ad53b775960092cbea0043e34a16ef2b2d1b309523d1f9950a447c0f53ccbdb4
3
+ metadata.gz: ea20c84e27eb6be3f752bb38fda926ee2aa1ec585e53ba526739bd74b0de569e
4
+ data.tar.gz: 0f1379f39973c54056a18d13d072204887d78a332a0a2a8e83532962c48cf07e
5
5
  SHA512:
6
- metadata.gz: e93a9969fbfd9d640bff442858e66c46379da35fe2a1394e6a395c334c26d96a6ed59f2baa869f68804c64587bf28ea129f566cde9755900aac7813210700641
7
- data.tar.gz: b8714703994cb455e7ae1d4b211562bc72fa68865d7386a1a2e4417d9a4ad86fdfd9b2971e15cc009945e5a0665a3b79d515cbbf5f7e07465d504b87a5b4c4f8
6
+ metadata.gz: 6c4932b932e51cab41daaeeebc38bc61808275a92005170bdb675e2ec2c200eaa629f22272647f7f507e46b230c3dce692b738fcf23cbdd2c0a74f2f73cb28ea
7
+ data.tar.gz: 399843bd7b7960da78ec36f2e8e5032b397b7dffd61310e0a0b5a72b0c96adaa314c0422f2715e54e4c8564c2c55385e889702c734ae30a2916c548970fde925
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- maremma (4.2.3)
4
+ maremma (4.2.4)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  addressable (>= 2.3.6)
7
7
  builder (~> 3.2, >= 3.2.2)
@@ -15,6 +15,7 @@ require 'maremma/set_host'
15
15
 
16
16
  module Maremma
17
17
  DEFAULT_TIMEOUT = 60
18
+ ALLOWED_CONTENT_TAGS = %w(strong em b i code pre sub sup br)
18
19
  NETWORKABLE_EXCEPTIONS = [Faraday::ClientError,
19
20
  Faraday::TimeoutError,
20
21
  Faraday::ResourceNotFound,
@@ -26,6 +27,8 @@ module Maremma
26
27
  NoMethodError,
27
28
  TypeError]
28
29
 
30
+ ActiveSupport::XmlMini.backend = 'Nokogiri'
31
+
29
32
  def self.post(url, options={})
30
33
  self.method(url, options.merge(method: "post"))
31
34
  end
@@ -221,7 +224,13 @@ module Maremma
221
224
  end
222
225
 
223
226
  # keep XML attributes, http://stackoverflow.com/a/10794044
227
+ # escape tags allowed in content
224
228
  def self.from_xml(string)
229
+ ALLOWED_CONTENT_TAGS.each do |tag|
230
+ string.gsub!("<#{tag}>", "&lt;#{tag}&gt;")
231
+ string.gsub!("</#{tag}>", "&lt;/#{tag}&gt;")
232
+ end
233
+
225
234
  if Nokogiri::XML(string, nil, 'UTF-8').errors.empty?
226
235
  Hash.from_xml(string)
227
236
  else
@@ -1,3 +1,3 @@
1
1
  module Maremma
2
- VERSION = "4.2.3"
2
+ VERSION = "4.2.4"
3
3
  end
@@ -573,6 +573,11 @@ describe Maremma do
573
573
  expect(subject.parse_success_response(string)).to eq("data"=>{"word"=>{"type"=>"small", "__content__"=>"abc"}})
574
574
  end
575
575
 
576
+ it 'from_xml with allowed content attributes' do
577
+ string = '<title>Sexual conflict and correlated evolution between male persistence and female resistance traits in the seed beetle <i>Callosobruchus maculatus</i></title>'
578
+ expect(subject.parse_success_response(string)).to eq("data"=>{"title"=>"Sexual conflict and correlated evolution between male persistence and female resistance traits in the seed beetle <i>Callosobruchus maculatus</i>"})
579
+ end
580
+
576
581
  it 'from_xml with attribute type string' do
577
582
  string = '<crm-item name="publisher-name" type="string">eLife Sciences Publications, Ltd</crm-item>'
578
583
  expect(subject.parse_success_response(string)).to eq("data"=>{"crm_item"=>"eLife Sciences Publications, Ltd"})
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maremma
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3
4
+ version: 4.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-03 00:00:00.000000000 Z
11
+ date: 2019-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday