html2odt 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/html2odt.gemspec +1 -1
- data/lib/html2odt/document.rb +25 -12
- data/lib/html2odt/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4faafbc073e768bc0f1752ffe28e9227bb2a0ff7
|
4
|
+
data.tar.gz: fba8f90511c1205ec52d7cd466f3573ab2627f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70d0313da825e9fc5e426716d570891f675e1c3ab772149d64c8668011eefd60de1915e2e736f2650726567f11c8eebbe97b48c6e698bfd314df6076611b166a
|
7
|
+
data.tar.gz: d2830075e1fe36f1be2e78056d3f582396c77b40e7282c503e7cfd899e8571967fef6f75fededef12f6744200ae050a8277e9a7d794c3c6be2c6f0ddbf4d8bd5
|
data/CHANGELOG.md
CHANGED
data/html2odt.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables << "html2odt.rb"
|
21
21
|
|
22
22
|
spec.add_dependency "dimensions", "~> 1.3.0"
|
23
|
-
spec.add_dependency "nokogiri", "~> 1.6.
|
23
|
+
spec.add_dependency "nokogiri", "~> 1.6.8"
|
24
24
|
spec.add_dependency "rubyzip", "~> 1.0"
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.12"
|
data/lib/html2odt/document.rb
CHANGED
@@ -307,18 +307,7 @@ class Html2Odt::Document
|
|
307
307
|
uri = URI.parse(src)
|
308
308
|
end
|
309
309
|
|
310
|
-
|
311
|
-
file.binmode
|
312
|
-
|
313
|
-
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
|
314
|
-
resp = http.get(uri.path)
|
315
|
-
|
316
|
-
file.write(resp.body)
|
317
|
-
file.flush
|
318
|
-
file
|
319
|
-
end
|
320
|
-
|
321
|
-
return file
|
310
|
+
return uri_to_file(uri)
|
322
311
|
end
|
323
312
|
|
324
313
|
# cannot handle image properly, return nil
|
@@ -373,4 +362,28 @@ class Html2Odt::Document
|
|
373
362
|
entry.content = content unless content.nil?
|
374
363
|
entry
|
375
364
|
end
|
365
|
+
|
366
|
+
def uri_to_file(uri)
|
367
|
+
file = Tempfile.new("html2odt")
|
368
|
+
file.binmode
|
369
|
+
|
370
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") do |http|
|
371
|
+
resp = http.get(uri.path)
|
372
|
+
|
373
|
+
file.write(resp.body)
|
374
|
+
file.flush
|
375
|
+
file
|
376
|
+
end
|
377
|
+
|
378
|
+
file
|
379
|
+
rescue
|
380
|
+
# Could not fetch remote image
|
381
|
+
#
|
382
|
+
# I feel bad for capturing all exceptions here, but there are so many
|
383
|
+
# libraries involved when fetching a resource over HTTP, that I am not sure
|
384
|
+
# how to create a proper white list. Some of the errors involved may be
|
385
|
+
#
|
386
|
+
# SocketError, OpenSSL::SSL::SSLError
|
387
|
+
nil
|
388
|
+
end
|
376
389
|
end
|
data/lib/html2odt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html2odt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregor Schmidt (Planio)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dimensions
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.6.
|
33
|
+
version: 1.6.8
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.6.
|
40
|
+
version: 1.6.8
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubyzip
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|