jekyll-fetch 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-fetch/version.rb +1 -1
- data/lib/jekyll-fetch.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c48088f55e630fa5865535fdcf4eb47bfef25c876d965f1e254199d0977a5160
|
4
|
+
data.tar.gz: 96f9f13e4d5577f53d81c5697b2bf3298a5a8e5c8bb479ab61dcc9d57a3a053f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3b8b051a198b602949f1100341291754f02ec9c479ffdb9c2936d081622fe9a0bcc4055bfe413a61bc80514c35fabe7b75da68066d94853abe69691c210cc8b
|
7
|
+
data.tar.gz: 518db64573f46664c8c39dc20ce9a60ec282b7d67ef2a23a24704f2a2032c1f2b39714ce763eac6810758b3eb69a36774fba49f2d47e5942309092e3ff51f76f
|
data/lib/jekyll-fetch/version.rb
CHANGED
data/lib/jekyll-fetch.rb
CHANGED
@@ -12,11 +12,12 @@ module Jekyll
|
|
12
12
|
# You should choose better exception.
|
13
13
|
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
|
14
14
|
|
15
|
+
puts uri_str
|
15
16
|
url = URI.parse(uri_str)
|
16
17
|
req = Net::HTTP::Get.new(url.path, { 'User-Agent' => 'Mozilla/5.0 (etc...)' })
|
17
18
|
response = Net::HTTP.start(url.host, url.port, use_ssl: true) { |http| http.request(req) }
|
18
19
|
case response
|
19
|
-
when Net::HTTPSuccess then response.body
|
20
|
+
when Net::HTTPSuccess then response.body.force_encoding("UTF-8")
|
20
21
|
when Net::HTTPRedirection then fetch(response['location'], limit - 1)
|
21
22
|
else
|
22
23
|
response.error!
|