utf8-cleaner 0.2.0 → 0.2.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: 3ef101f548a442f6dff1dcdad93983578b0c9afd
4
- data.tar.gz: 7e02ed8d5d55c4bd6dc9033f0740bd6a5fc85cc0
3
+ metadata.gz: 374bd095410578dc3d8cde50fee9d63fc4368c3a
4
+ data.tar.gz: 69dc3e51d0697d179ae0f2f6170cd7d6b7767087
5
5
  SHA512:
6
- metadata.gz: 87eb291f74fcc40fff6ccd80567e23e0556d1fee28657a22a089293024459023abe89a7bbeb31db24b380bee9da7095146377346c9a8524fab0f9dc9b3878d00
7
- data.tar.gz: 761762367fca098c24fe872708b621c490075bf0d7c7a57cc07f209555c190b178890c6973a34a6b135d4baafbbfbf92b845fc5886b2cbf328b2d98535f1e92b
6
+ metadata.gz: 798c9c14ddca0d1e77796a24f2a5adb268dfe9f0e55a4664fe05b1d218aa02bf64d185e6ccb84174bd4329abd2ea6a2f03009b3c0d3fddb8e9754238cf4fe686
7
+ data.tar.gz: c4553b88e53826bcf6b5f28019bb74b18b1f7cf6c6eb9db373144a9c355d56cb54021eb8a098c65a7d136605b52494dc099e8c2419a7526fd3b6ca83185d264e
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## V0.2.1
4
+
5
+ * Cleans request body when content type is application/json
6
+
3
7
  ## V0.2.0
4
8
 
5
9
  * Removes invalid %-encodings like "%x", "%0z", and "%" if not followed by two hex chars
@@ -40,7 +40,7 @@ module UTF8Cleaner
40
40
 
41
41
  def sanitize_env_rack_input(env)
42
42
  case env['CONTENT_TYPE']
43
- when 'application/x-www-form-urlencoded'
43
+ when 'application/x-www-form-urlencoded','application/json'
44
44
  cleaned_value = cleaned_string(env['rack.input'].read)
45
45
  env['rack.input'] = StringIO.new(cleaned_value) if cleaned_value
46
46
  env['rack.input'].rewind
@@ -1,3 +1,3 @@
1
1
  module UTF8Cleaner
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -56,6 +56,16 @@ module UTF8Cleaner
56
56
  expect(new_env['rack.input'].read).to eq "foo=%FFbar%F8"
57
57
  end
58
58
  end
59
+
60
+ describe "when json data is POSTed" do
61
+ before do
62
+ env['CONTENT_TYPE'] = 'application/json'
63
+ end
64
+ it "removes removes invalid %-encoded UTF-8 sequences" do
65
+ env['rack.input'].rewind
66
+ expect(new_env['rack.input'].read).to eq('foo=bar')
67
+ end
68
+ end
59
69
  end
60
70
 
61
71
  describe "with a minimal env" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utf8-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leon Miller-Out
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport