sanitize-rails 0.9.1 → 1.0.0
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 +4 -4
- data/.gitignore +1 -0
- data/lib/sanitize/rails/active_record.rb +3 -3
- data/lib/sanitize/rails/engine.rb +3 -2
- data/lib/sanitize/rails/version.rb +1 -1
- data/sanitize-rails.gemspec +1 -1
- data/test/sanitize_rails_string_extension_test.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ec8f2b92a344e0040ed2e8b9ab5f2f04aaeeca3
|
4
|
+
data.tar.gz: f0f4f8f6956493fa27bd846d8ddc6152ba93c74c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98043ba7284b51877fb1b2613cf1fb4c54b1ea7e76331e230b0f0613e180730db6427f134e10d7f01176fb82b173c9b8c43b7d1b95af8c666b3edd2ad7efa264
|
7
|
+
data.tar.gz: 2ccaf00041d33e2eb027e746d945f5d92f172237d4ae8d452c37eb306a3d672c64824656943213f0e15b52dcc729c9823cd52ad78a6ddd3310d45c2f0f4be91b
|
data/.gitignore
CHANGED
@@ -22,10 +22,10 @@ module Sanitize::Rails
|
|
22
22
|
|
23
23
|
define_method(sanitizer) do # # Unrolled version
|
24
24
|
fields.each do |field| #
|
25
|
-
value =
|
25
|
+
value = read_attribute(field)
|
26
26
|
unless value.blank? # def sanitize_fieldA_fieldB
|
27
|
-
sanitized = Engine.clean(value) #
|
28
|
-
|
27
|
+
sanitized = Engine.clean(value) # write_attribute(fieldA, Engine.clean(read_attribute(fieldA))) unless fieldA.blank?
|
28
|
+
write_attribute(field, sanitized) # write_attribute(fieldB, Engine.clean(read_attribute(fieldB))) unless fieldB.blank?
|
29
29
|
end # end
|
30
30
|
end #
|
31
31
|
end # end
|
@@ -32,13 +32,14 @@ module Sanitize::Rails
|
|
32
32
|
# means that text passed through `Sanitize::Rails::Engine.clean`
|
33
33
|
# will not be escaped by ActionView's XSS filtering utilities.
|
34
34
|
def clean(string)
|
35
|
-
::ActiveSupport::SafeBuffer.new
|
35
|
+
::ActiveSupport::SafeBuffer.new cleaner.fragment(string)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Sanitizes the given `string` in place and does NOT mark it as `html_safe`
|
39
39
|
#
|
40
40
|
def clean!(string)
|
41
|
-
|
41
|
+
return '' if string.nil?
|
42
|
+
string.replace cleaner.fragment(string)
|
42
43
|
end
|
43
44
|
|
44
45
|
def callback_for(options) #:nodoc:
|
data/sanitize-rails.gemspec
CHANGED
@@ -17,7 +17,7 @@ class SanitizeRailsStringExtensionTest < Minitest::Test
|
|
17
17
|
assert_instance_of SanitizableString, sanitizable_string
|
18
18
|
|
19
19
|
new_string = sanitizable_string.sanitize_as_html!
|
20
|
-
assert_instance_of
|
20
|
+
assert_instance_of SanitizableString, new_string
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_respond_to_sanitize_as_html
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanitize-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcello Barnaba
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '3.0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '3.0'
|
43
43
|
description:
|
44
44
|
email:
|
45
45
|
- vjt@openssl.it
|