rack-prerender 1.6.2.4 → 1.6.2.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 +4 -4
- data/lib/rack/prerender/fetcher.rb +15 -3
- data/lib/rack/prerender/version.rb +1 -1
- 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: 214c24f71f1b6bfb3bd245b66013a219c1cecc2a96e687561c0c7d3d96387561
|
4
|
+
data.tar.gz: 485b5f198ec21558fa3c46ad413f61df80000253c35bfdf6abccc0d4ac947609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d551125d95c528aec7bee9b5c96a8ac3fbdb81e1c0bd8b354e39bebf3e15b10bd2bc0269e02270c490cccefa3f4255e803590f42b6224ccd77e0a3589c8a56eb
|
7
|
+
data.tar.gz: adf25685296e385886d1a5733e1301386454b558f6147000508ffa0ef842f54e3d8c3c562e6d1a52c5b68bb9a4fc46f706a4a4c7f6a1312721fc8485622df944
|
@@ -30,7 +30,13 @@ module Rack
|
|
30
30
|
when Hash then fetch_env(arg)
|
31
31
|
when Rack::Request then fetch_env(arg.env)
|
32
32
|
else
|
33
|
-
|
33
|
+
if defined?(ActiveModel::Naming) && ActiveModel::Naming === arg.class
|
34
|
+
record_url = Rails.application.routes.url_helpers.url_for(arg)
|
35
|
+
fetch_url(record_url)
|
36
|
+
else
|
37
|
+
raise ArgumentError,
|
38
|
+
"expected URL, Request, env or record, got #{arg.class}"
|
39
|
+
end
|
34
40
|
end
|
35
41
|
end
|
36
42
|
|
@@ -53,8 +59,14 @@ module Rack
|
|
53
59
|
end
|
54
60
|
|
55
61
|
def fetch_url(url, as: nil)
|
56
|
-
uri =
|
57
|
-
fetch_api_uri(uri, as: as)
|
62
|
+
uri = try_uri_parse(api_url(url))
|
63
|
+
uri && fetch_api_uri(uri, as: as)
|
64
|
+
end
|
65
|
+
|
66
|
+
def try_uri_parse(url)
|
67
|
+
URI.parse(url)
|
68
|
+
rescue URI::InvalidURIError
|
69
|
+
nil
|
58
70
|
end
|
59
71
|
|
60
72
|
# This is just horrible, but replacing net/http would break compatibility
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-prerender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.2.
|
4
|
+
version: 1.6.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Hooper
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-04-
|
12
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|