non_printable_sanitization 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/non_printable_sanitization.rb +2 -9
- data/lib/non_printable_sanitization/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b953dd11a115dd5768ab2fe02c2a9ab51241a64
|
4
|
+
data.tar.gz: 3c436a89d0c0eb9066ebaf8d32ca878ef0b6de48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
45
|
-
input
|
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
|