sanitize 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sanitize might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/HISTORY.md +7 -0
- data/lib/sanitize.rb +1 -1
- data/lib/sanitize/config.rb +1 -1
- data/lib/sanitize/version.rb +1 -1
- data/test/test_sanitize.rb +11 -0
- data/test/test_transformers.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a202a438bce353e37e37dc9c40522cea2269b934
|
4
|
+
data.tar.gz: 226373f045e2d040b1d0902b34b873187257cd65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fec7ba0e5c844402e5723ec9c51645a2d801de463af61cb6b893c6bdcc7a0901cc13d737ef42408e162335bad69440c4d575e903864f385eb0973b3f57e6266
|
7
|
+
data.tar.gz: 1f38a977ffcbf56d321c808e39e26d5b44fe8c1826b11ee977e9ffe34c45c59b2ff896e65a9f5e799efab9598e5daa959d33fee3998d591d0fd2ed8989864d06
|
data/HISTORY.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Sanitize History
|
2
2
|
|
3
|
+
## 4.3.0 (2016-09-20)
|
4
|
+
|
5
|
+
* Methods can now be used as transformers. [@Skipants - #155][155]
|
6
|
+
|
7
|
+
[155]:https://github.com/rgrove/sanitize/pull/155
|
8
|
+
|
9
|
+
|
3
10
|
## 4.2.0 (2016-08-22)
|
4
11
|
|
5
12
|
* Added `-webkit-font-smoothing` to the relaxed CSS config. [@louim - #154][154]
|
data/lib/sanitize.rb
CHANGED
@@ -77,7 +77,7 @@ class Sanitize
|
|
77
77
|
def initialize(config = {})
|
78
78
|
@config = Config.merge(Config::DEFAULT, config)
|
79
79
|
|
80
|
-
@transformers = Array(@config[:transformers].dup
|
80
|
+
@transformers = Array(@config[:transformers]).dup
|
81
81
|
|
82
82
|
# Default transformers always run at the end of the chain, after any custom
|
83
83
|
# transformers.
|
data/lib/sanitize/config.rb
CHANGED
@@ -52,7 +52,7 @@ class Sanitize
|
|
52
52
|
# Returns `true` if `dup` may be safely called on _value_, `false`
|
53
53
|
# otherwise.
|
54
54
|
def self.can_dupe?(value)
|
55
|
-
!(true == value || false == value || value.nil? || Numeric === value || Symbol === value)
|
55
|
+
!(true == value || false == value || value.nil? || Method === value || Numeric === value || Symbol === value)
|
56
56
|
end
|
57
57
|
private_class_method :can_dupe?
|
58
58
|
|
data/lib/sanitize/version.rb
CHANGED
data/test/test_sanitize.rb
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
require_relative 'common'
|
3
3
|
|
4
4
|
describe 'Sanitize' do
|
5
|
+
describe 'initializer' do
|
6
|
+
it 'should not modify a transformers array in the given config' do
|
7
|
+
transformers = [
|
8
|
+
lambda {}
|
9
|
+
]
|
10
|
+
|
11
|
+
Sanitize.new({ :transformers => transformers })
|
12
|
+
transformers.length.must_equal(1)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
5
16
|
describe 'instance methods' do
|
6
17
|
before do
|
7
18
|
@s = Sanitize.new
|
data/test/test_transformers.rb
CHANGED
@@ -77,6 +77,12 @@ describe 'Transformers' do
|
|
77
77
|
called.must_equal true
|
78
78
|
end
|
79
79
|
|
80
|
+
it 'should accept a method transformer' do
|
81
|
+
def transformer(env); end
|
82
|
+
Sanitize.fragment('<div>foo</div>', :transformers => method(:transformer))
|
83
|
+
.must_equal(' foo ')
|
84
|
+
end
|
85
|
+
|
80
86
|
describe 'Image whitelist transformer' do
|
81
87
|
require 'uri'
|
82
88
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sanitize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Grove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: crass
|