preadly-bulbasaur 0.6.0 → 0.6.1
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: 40b514207389a8d48e89d57e1368bdf5c05db0dd
|
4
|
+
data.tar.gz: 8ec55684674c1587f0a6ecf7a1d851a182683977
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27980ae974932ced7c96047c3f4811df95d54fea82d481776b43f933a2979f3ed736fa2aab25fa378632a7040f762019677688a9ef3bce0c93e9d8d1d2eceab0
|
7
|
+
data.tar.gz: 64a1c0ccfd39f8bfe3d68bda43a28d8518741cfbc5107fbcc5060ad79e6fc8d45be734384b1dff7c041fa6317d1f8e8497c0964ac987cbbdc5064f434042dbca
|
@@ -1,21 +1,15 @@
|
|
1
1
|
module Bulbasaur
|
2
|
-
|
3
2
|
class NormalizeURL
|
4
|
-
|
5
3
|
def initialize(base_url, context_url)
|
6
4
|
@base_url = base_url
|
7
5
|
@context_url = context_url
|
8
6
|
end
|
9
7
|
|
10
8
|
def call
|
11
|
-
|
12
|
-
|
13
|
-
else
|
14
|
-
URI::join(@base_url, @context_url).to_s
|
15
|
-
end
|
9
|
+
url = (@context_url =~ /^https?:\/\//) ? @context_url : URI::join(@base_url, @context_url).to_s
|
10
|
+
URI::encode URI::decode url
|
16
11
|
rescue
|
17
|
-
raise ArgumentError, "
|
12
|
+
raise ArgumentError, "Unable to normalize URL. Params: [base_url: #{@base_url}, context_url: #{@context_url}]."
|
18
13
|
end
|
19
|
-
|
20
14
|
end
|
21
15
|
end
|
data/lib/bulbasaur/version.rb
CHANGED
@@ -45,6 +45,14 @@ RSpec.describe Bulbasaur::NormalizeURL do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
context 'When using an encoded URL' do
|
49
|
+
let(:context_url) { 'http://www.test.com/Hello%C3%A7a_9.jpg~original' }
|
50
|
+
|
51
|
+
it 'returns the normalized URL' do
|
52
|
+
expect(subject).to eq 'http://www.test.com/Hello%C3%A7a_9.jpg~original'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
48
56
|
context "When use url not normalized with slash on base: hello.jpg" do
|
49
57
|
|
50
58
|
let(:base_url) do
|