safe_redirect_rails 0.1.7 → 0.1.8
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b0bd9bb8beaeb47abc25f65bc908bc7416ca732ba14575822c8ee8476d3b4ef
|
4
|
+
data.tar.gz: 347c1c12104ddd8bf7a3ce5046167e34c717363836c1ee345b7831c7b1356953
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aa6ca0a3c153a819b736e0c3833b4499cfed7d7983f5a7331b74513b827677439afeebbae1dcb059968a41327f434f1e65841bd262bc045c61069a123241ff6
|
7
|
+
data.tar.gz: 7fdbeb3ce9cebbd6137c2677f2fb3ae9cfe201e9b12467a6cb4ae216bb2330ef1885efafc2003366b49d4f5c6e715ba2f9640d358cdab160cbcb18bdc42e4ab4
|
@@ -9,7 +9,8 @@ module SafeRedirectRails
|
|
9
9
|
|
10
10
|
SafeRedirectRails.configuration.domain_whitelists.any? do |pattern|
|
11
11
|
regexp = domain_pattern_to_regex(pattern)
|
12
|
-
uri.
|
12
|
+
host_with_port = uri.port && ![80, 443].include?(uri.port) ? "#{uri.host}:#{uri.port}" : uri.host
|
13
|
+
host_with_port.match?(regexp)
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -87,6 +88,7 @@ module SafeRedirectRails
|
|
87
88
|
def domain_pattern_to_regex(pattern)
|
88
89
|
escaped = pattern.split("*").map { |part| Regexp.escape(part) }.join("*")
|
89
90
|
regex_str = "^" + escaped.gsub("*", "[A-Za-z0-9\-]+") + "$"
|
91
|
+
regex_str = regex_str.gsub("$", "(:[0-9]+)?$")
|
90
92
|
Regexp.new(regex_str)
|
91
93
|
end
|
92
94
|
|
Binary file
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safe_redirect_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tuan Pham
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: This gem provides a simple way to redirect to safe URLs
|
13
13
|
email:
|
@@ -24,6 +24,7 @@ files:
|
|
24
24
|
- lib/safe_redirect_rails/configuration.rb
|
25
25
|
- lib/safe_redirect_rails/safe_redirect_rails.rb
|
26
26
|
- lib/safe_redirect_rails/version.rb
|
27
|
+
- safe_redirect_rails-0.1.7.gem
|
27
28
|
- safe_redirect_rails.gemspec
|
28
29
|
- sig/safe_redirect_rails.rbs
|
29
30
|
licenses: []
|
@@ -43,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
44
|
- !ruby/object:Gem::Version
|
44
45
|
version: '0'
|
45
46
|
requirements: []
|
46
|
-
rubygems_version: 3.6.
|
47
|
+
rubygems_version: 3.6.9
|
47
48
|
specification_version: 4
|
48
49
|
summary: This gem provides a simple way to redirect to safe URLs
|
49
50
|
test_files: []
|