non_printable_sanitization 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: e3bb17f01ea9d8c04ab0285e1dd5d389e569c5a0
4
- data.tar.gz: 384b85affb91c091900c75a2c59da64c36b691bd
3
+ metadata.gz: 8b953dd11a115dd5768ab2fe02c2a9ab51241a64
4
+ data.tar.gz: 3c436a89d0c0eb9066ebaf8d32ca878ef0b6de48
5
5
  SHA512:
6
- metadata.gz: e6dcb697b11d5cffb4e85b0abefc1b79273c8a030d816a51b26e0507ee4b24777ef395b20ed8c9ea7ee5104e7113f101144e2053723cf08413ec7a0aed88827a
7
- data.tar.gz: 819c0863c0bdec13b2336abd5e4bf89f61599bfae4d2c0d71bdd97b7cb3b50ea38497ff7181382d3b5b48f5bbf4ff0d1e5a5d0cc53ff9d754cffe9c27f7e54d5
6
+ metadata.gz: ea3abc228beec60dadeb21c8bf98fefe438519080f3ee0b03b45493f73c7b35ee895845ebf20548bb3e3d51654e6a69b779dc57ed6057c00a4305cd9fb37d1b6
7
+ data.tar.gz: 8a27d891efac0d9b0a23e6ffd3f972f0ab082770f307991c3ee9ba04c05d9e7ddc9d5393057902536ed131af2c250ddc49c1dbee569cf849fca9f4c3f0f580b0
@@ -32,19 +32,12 @@ class NonPrintableSanitization
32
32
 
33
33
  private
34
34
 
35
- def is_url_encoded?(env)
36
- content_type = env["CONTENT_TYPE"] || "none"
37
- content_type.downcase.include?("urlencoded")
38
- end
39
-
40
35
  def remove_non_printable_characters!(env)
41
36
  input = env["rack.input"].read
42
37
 
43
38
  if input && input.size > 0
44
- url_encoded = is_url_encoded?(env)
45
- input = ::URI.decode(input) if url_encoded
46
- input.gsub!(/[[:cntrl:]]/, "")
47
- input = ::URI.encode(input) if url_encoded
39
+ input.gsub!("\x00", "")
40
+ input.gsub!("%00", "")
48
41
  env["rack.input"] = StringIO.new(input)
49
42
  end
50
43
  ensure
@@ -1,3 +1,3 @@
1
1
  class NonPrintableSanitization
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: non_printable_sanitization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Dewitt