safe_redirect 0.1.4 → 0.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a6d01c7330bafc677a98f499e04b7db0a6c27cf
|
4
|
+
data.tar.gz: 1672f119857023640eda0223d20e72a214de0129
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b9cb5dc6823258bbe67023e1788fe357328e51bd9511345edea8048505ea269641dca477cc9df62fadd038d03065e5676d2d2b1e2365689451b2eaa718b761f
|
7
|
+
data.tar.gz: df89615fd2dbef7f302024a2ae396e70a6329378e6d38e8242c62d18cc9aa2824f768c740fcaec5f7c79f31fcc4e02b99b347f8c72d575a89895f6e06321fb46
|
@@ -10,7 +10,7 @@ module SafeRedirect
|
|
10
10
|
case
|
11
11
|
when path.kind_of?(String)
|
12
12
|
clean_path(path)
|
13
|
-
when path.kind_of?(Symbol)
|
13
|
+
when path.kind_of?(Symbol) || path.kind_of?(Hash)
|
14
14
|
path
|
15
15
|
else
|
16
16
|
SafeRedirect.configuration.default_path
|
@@ -18,7 +18,8 @@ module SafeRedirect
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def redirect_to(path, options={})
|
21
|
-
|
21
|
+
target = options[:safe] ? path : safe_path(path)
|
22
|
+
super safe_path(target), options
|
22
23
|
rescue NoMethodError
|
23
24
|
end
|
24
25
|
|
@@ -50,6 +50,10 @@ module SafeRedirect
|
|
50
50
|
expect(Controller.safe_path(:back)).to eq(:back)
|
51
51
|
end
|
52
52
|
|
53
|
+
it "considers {controller: 'home', action: 'index'} a safe path" do
|
54
|
+
expect(Controller.safe_path({controller: 'home', action: 'index'})).to eq({controller: 'home', action: 'index'})
|
55
|
+
end
|
56
|
+
|
53
57
|
it "considers https://www.bukalapak.com@google.com an unsafe path" do
|
54
58
|
expect(Controller.safe_path('https://www.bukalapak.com@google.com')).to eq('/')
|
55
59
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe_redirect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edwin Tunggawan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|