wovnrb 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +2 -2
- data/lib/wovnrb/headers.rb +4 -4
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/headers_test.rb +22 -0
- data/wovnrb.gemspec +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7142c7b987c9c606c3e49258ed9e0aff9948da0fb72b20f0cc830e3c0c65de1
|
4
|
+
data.tar.gz: 70868e06450c6e67a01c277403993c75432793f2a985bfdd76dac92731cc6e4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b3667f117278b2646b38b80488aa74f18af0bec771d3ba09bd3232a83d6175fbed349ab2ff6912f2e3201000be11590a4a83a9cb015c8cebbc2a388f66cbac3
|
7
|
+
data.tar.gz: c162e510d61ab75be43cb0e1ee8fa1e6ffd3b986b200d90b65cb1744128e87f6bc433fa4a231c69ef825a07de500c58ed3ce2c20d962fb3c2a84ae4b8157f9c6
|
data/.rubocop_todo.yml
CHANGED
@@ -29,7 +29,7 @@ Layout/ExtraSpacing:
|
|
29
29
|
# Cop supports --auto-correct.
|
30
30
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
31
31
|
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
32
|
-
Layout/
|
32
|
+
Layout/FirstHashElementIndentation:
|
33
33
|
Exclude:
|
34
34
|
- 'lib/wovnrb/text_caches/cache_base.rb'
|
35
35
|
|
@@ -37,7 +37,7 @@ Layout/IndentFirstHashElement:
|
|
37
37
|
# Cop supports --auto-correct.
|
38
38
|
# Configuration parameters: EnforcedStyle.
|
39
39
|
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
40
|
-
Layout/
|
40
|
+
Layout/HeredocIndentation:
|
41
41
|
Exclude:
|
42
42
|
- 'test/lib/lang_test.rb'
|
43
43
|
- 'test/lib/wovnrb_test.rb'
|
data/lib/wovnrb/headers.rb
CHANGED
@@ -30,7 +30,7 @@ module Wovnrb
|
|
30
30
|
end
|
31
31
|
# REQUEST_URI is expected to not contain the server name
|
32
32
|
# heroku contains http://...
|
33
|
-
@env['REQUEST_URI'] = @env['REQUEST_URI'].sub(
|
33
|
+
@env['REQUEST_URI'] = @env['REQUEST_URI'].sub(/^https?:\/\/[^\/]+/, '') if @env['REQUEST_URI'] =~ /^https?:\/\//
|
34
34
|
@unmasked_pathname = @env['REQUEST_URI'].split('?')[0]
|
35
35
|
@unmasked_pathname += '/' unless @unmasked_pathname =~ /\/$/ || @unmasked_pathname =~ /\/[^\/.]+\.[^\/.]+$/
|
36
36
|
@unmasked_url = "#{@protocol}://#{@unmasked_host}#{@unmasked_pathname}"
|
@@ -193,13 +193,13 @@ module Wovnrb
|
|
193
193
|
case @settings['url_pattern']
|
194
194
|
when 'query'
|
195
195
|
lang_param_name = @settings['lang_param_name']
|
196
|
-
|
196
|
+
uri.sub(/(^|\?|&)#{lang_param_name}=#{lang_code}(&|$)/, '\1').gsub(/(\?|&)$/, '')
|
197
197
|
when 'subdomain'
|
198
198
|
rp = Regexp.new('(^|(//))' + lang_code + '\.', 'i')
|
199
|
-
|
199
|
+
uri.sub(rp, '\1')
|
200
200
|
# when 'path'
|
201
201
|
else
|
202
|
-
|
202
|
+
uri.sub(/\/#{lang_code}(\/|$)/, '/')
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
data/lib/wovnrb/version.rb
CHANGED
data/test/lib/headers_test.rb
CHANGED
@@ -139,6 +139,28 @@ module Wovnrb
|
|
139
139
|
assert_equal('/test/', headers.pathname_with_trailing_slash_if_present)
|
140
140
|
end
|
141
141
|
|
142
|
+
def test_pathname_for_unencoded_url
|
143
|
+
h = Wovnrb::Headers.new(
|
144
|
+
Wovnrb.get_env('REQUEST_URI' => '/v0/download_html?url=https://wovn.io/'),
|
145
|
+
Store.instance.settings
|
146
|
+
)
|
147
|
+
|
148
|
+
assert_equal('/v0/download_html', h.pathname)
|
149
|
+
assert_equal('/v0/download_html', h.pathname_with_trailing_slash_if_present)
|
150
|
+
assert_equal('wovn.io/v0/download_html?url=https://wovn.io/', h.url)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_pathname_for_unencoded_url_with_http_scheme
|
154
|
+
h = Wovnrb::Headers.new(
|
155
|
+
Wovnrb.get_env('REQUEST_URI' => 'https://wovn.io/v0/download_html?url=https://wovn.io/'),
|
156
|
+
Store.instance.settings
|
157
|
+
)
|
158
|
+
|
159
|
+
assert_equal('/v0/download_html', h.pathname)
|
160
|
+
assert_equal('/v0/download_html', h.pathname_with_trailing_slash_if_present)
|
161
|
+
assert_equal('wovn.io/v0/download_html?url=https://wovn.io/', h.url)
|
162
|
+
end
|
163
|
+
|
142
164
|
#########################
|
143
165
|
# REDIRECT_LOCATION
|
144
166
|
#########################
|
data/wovnrb.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_dependency 'activesupport'
|
23
23
|
spec.add_dependency 'addressable'
|
24
24
|
spec.add_dependency 'lz4-ruby'
|
25
|
-
spec.add_dependency 'nokogiri', '
|
25
|
+
spec.add_dependency 'nokogiri', '>= 1.8.1'
|
26
26
|
spec.add_dependency 'nokogumbo', '>= 1.4.0', '< 2.0.0'
|
27
27
|
spec.add_dependency 'rack'
|
28
28
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wovnrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Sandford
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
name: nokogiri
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 1.8.1
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 1.8.1
|
70
70
|
- !ruby/object:Gem::Dependency
|
@@ -461,7 +461,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
461
461
|
- !ruby/object:Gem::Version
|
462
462
|
version: '0'
|
463
463
|
requirements: []
|
464
|
-
|
464
|
+
rubyforge_project:
|
465
|
+
rubygems_version: 2.7.6.2
|
465
466
|
signing_key:
|
466
467
|
specification_version: 4
|
467
468
|
summary: Gem for WOVN.io
|