epub_book 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b59e19ce1a3a4971fa36242b21bf2c97dccd9e70
4
- data.tar.gz: 7a7d2375e31668da5dd54735df4dfbcbd47e4059
3
+ metadata.gz: 4f97b7dd57c6d5f908aad4c6ff2e02bd0d850e5e
4
+ data.tar.gz: 0b0a7fb475fff417e0412b2758ddcb74d4dd5e25
5
5
  SHA512:
6
- metadata.gz: cfef6838e84ec34cf416053c53ee108b6d0537771d63b10a921e1b03fac0840353f420f5f5e3d80d4c9a6b53e93a7c01f7bb0baa453625bc650192ef890f2cb5
7
- data.tar.gz: d7cd87aadefd549ff3b9f7f1f7b673de26a03cdba8a92a5e8620ae5cdb26f8e40b166ce2a035becdc1e0544952541c6ef5e42c79489cd7de40687e33aa46f23a
6
+ metadata.gz: 59a3c190c686e0ec7bf42f3c40e142ab3bd699679d489f7c2f93078861fbf6266eea540a02bd73253385b5e53c7318939936ca6eb1d68de7c8287ced27e64c2b
7
+ data.tar.gz: 5ef21c42347c49fb71c6282e7820f928bb17be68b5d1ba0cbf55013ce983bbb01d8db165f4c57362ab8cdebf0735d1dcbe8a45ad3a11ceeb6227015db911b24a
@@ -132,8 +132,8 @@ module EpubBook
132
132
  elsif _href.start_with?("/")
133
133
  _href = "#{link_host}#{_href}"
134
134
  else
135
- @path_name ||= File.dirname(@index_url)
136
- _href = "#{@path_name}/#{_href}"
135
+ @path_name ||= @index_url[/.*\//]
136
+ _href = "#{@path_name}#{_href}"
137
137
  end
138
138
 
139
139
  book[:files] << {label: item.text, url: _href}
@@ -188,6 +188,7 @@ module EpubBook
188
188
  private
189
189
  #is valid encoding
190
190
  def judge_encoding(str)
191
+ str.scrub! unless str.valid_encoding?
191
192
  /<meta.*?charset\s*=[\s\"\']?utf-8/i =~ str ? str : str.force_encoding('gbk').encode('utf-8')
192
193
  end
193
194
 
@@ -1,3 +1,3 @@
1
1
  module EpubBook
2
- VERSION = "0.1.11"
2
+ VERSION = "0.1.12"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epub_book
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - qmliu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-02 00:00:00.000000000 Z
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri