wovnrb 3.7.1 → 3.7.2
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/lib/wovnrb/url_language_switcher.rb +5 -1
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/url_language_switcher_test.rb +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6cc4b57cbbcb73d7c80599b43c3c5cc2cf942bd2488d6d53ed80cbc33810dc32
|
|
4
|
+
data.tar.gz: 075a4767449cfa394036400ab377be8659939f59c4229d9192b2042b9eabd65d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5952288b10b0d86e39ff6496bccc0a9c5d51ff876d0f41f07fb1b7b33cc9cab0792d2a1f7c97477849f4dedb20cfada495e6498255a987825c478f305e076f8
|
|
7
|
+
data.tar.gz: 323f2b3d50b221b67831c43b9a70e2d595bfd3d7a86f4325cbfbdb2fb700ce0cd48da7952f6a5950064d5766de34b743abd1d9f14dc3764677d61a6787a1e113
|
|
@@ -44,7 +44,11 @@ module Wovnrb
|
|
|
44
44
|
rp = Regexp.new("(^|(//))#{lang_code}\\.", 'i')
|
|
45
45
|
uri.sub(rp, '\1')
|
|
46
46
|
when 'path'
|
|
47
|
-
|
|
47
|
+
# ^(.*://|//)? 1: schema (optional) like https://
|
|
48
|
+
# ([^/]*/)? 2: host (optional) like wovn.io, with trailing '/' (mandatory)
|
|
49
|
+
# (/|$) 3: path or end-of-string
|
|
50
|
+
lang_code_pattern = %r{^(.*://|//)?([^/]*/)?#{lang_code}(/|$)}
|
|
51
|
+
uri.sub(lang_code_pattern, '\1\2')
|
|
48
52
|
else
|
|
49
53
|
raise RuntimeError("Invalid URL pattern: #{@store.settings['url_pattern']}")
|
|
50
54
|
end
|
data/lib/wovnrb/version.rb
CHANGED
|
@@ -876,17 +876,20 @@ module Wovnrb
|
|
|
876
876
|
def test_remove_lang_path
|
|
877
877
|
settings = Wovnrb.get_settings
|
|
878
878
|
store = Wovnrb.get_store(settings)
|
|
879
|
-
|
|
879
|
+
sut = UrlLanguageSwitcher.new(store)
|
|
880
880
|
|
|
881
881
|
keys = Wovnrb::Lang::LANG.keys
|
|
882
882
|
assert_equal(77, keys.size)
|
|
883
883
|
|
|
884
884
|
keys.each do |key|
|
|
885
|
-
|
|
886
|
-
assert_equal(
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
assert_equal(
|
|
885
|
+
assert_equal('/', sut.remove_lang_from_uri_component("/#{key}", key))
|
|
886
|
+
assert_equal("/dir/#{key}/page.html", sut.remove_lang_from_uri_component("/#{key}/dir/#{key}/page.html", key))
|
|
887
|
+
assert_equal('?query', sut.remove_lang_from_uri_component('?query', key))
|
|
888
|
+
assert_equal('wovn.io/', sut.remove_lang_from_uri_component("wovn.io/#{key}", key))
|
|
889
|
+
assert_equal("wovn.io/dir/#{key}/page.html", sut.remove_lang_from_uri_component("wovn.io/#{key}/dir/#{key}/page.html", key))
|
|
890
|
+
assert_equal("wovn.io:5000/dir/#{key}/page.html", sut.remove_lang_from_uri_component("wovn.io:5000/#{key}/dir/#{key}/page.html", key))
|
|
891
|
+
assert_equal('https://wovn.io/', sut.remove_lang_from_uri_component("https://wovn.io/#{key}/", key))
|
|
892
|
+
assert_equal("https://wovn.io/dir/#{key}/page.html", sut.remove_lang_from_uri_component("https://wovn.io/#{key}/dir/#{key}/page.html", key))
|
|
890
893
|
end
|
|
891
894
|
end
|
|
892
895
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wovnrb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.7.
|
|
4
|
+
version: 3.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wovn Technologies, Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-11-
|
|
11
|
+
date: 2022-11-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|