link_thumbnailer 2.5.1 → 2.5.2

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: 8ebb211bdc1846b8bd87073ba32ad911ce291294
4
- data.tar.gz: 0681efbd2d6315670e5b9888c66d27b898aa9401
3
+ metadata.gz: 49bbee58589eb5ba7a8e91f3747116510331160e
4
+ data.tar.gz: 8dde81b01a30960aa69febd8fe42f3bcb824b6a9
5
5
  SHA512:
6
- metadata.gz: 7b15cff3407a6e288a97f9923279b4f926b5f8d08bd00db52881dec032501198bd8dda0c635b14fd89054c2b83f87ce4a3557a9fe57d5490af8ed6f5b3905f74
7
- data.tar.gz: 576533b10d2f694ce8bbd974bc76af780a566227d37fc05d0ff82aca54c9807b521cdf56c457af06b8c9d54496aef04d0a51c21787af4479e7930f603847e48c
6
+ metadata.gz: 2031071a1077e7ad8915bfa11183e75f23a6e4e7d6a7700f661e599fa164fb2424dfa6fabd36576ca184ed97028199175d9087978514751528a68a93bc8a4c0e
7
+ data.tar.gz: 4806f8bb2bdd828739e1359bcf0bf784be459f69c7d13f1ec14efbff4738cf5d770447d6f0b181f8119c548266a0c98a756936ff19e651949e5e33f6d17add01
@@ -1,3 +1,7 @@
1
+ # 2.5.2
2
+
3
+ - Fix OpenURI::HTTPError exception raised when video_info gem is not able to parse video metadata. Fixes #60.
4
+
1
5
  # 2.5.1
2
6
 
3
7
  - Implement `Set-Cookie` header between http redirections to set cookies when site requires it. Fixes #55.
data/README.md CHANGED
@@ -9,6 +9,7 @@
9
9
  Ruby gem generating image thumbnails from a given URL. Rank them and give you back an object containing images and website informations. Works like Facebook link previewer.
10
10
 
11
11
  Demo Application is [here](http://link-thumbnailer-demo.herokuapp.com/) !
12
+ The source code of the Demo Application is hosted [here](https://github.com/gottfrois/link_thumbnailer_demo)!
12
13
 
13
14
  **OpenSource** and **Free** API available [here](https://github.com/gottfrois/link_thumbnailer_api) !
14
15
 
@@ -9,8 +9,9 @@ module LinkThumbnailer
9
9
 
10
10
  def sanitize(str)
11
11
  return unless str
12
- str.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').strip.gsub(/[\r\n\f]+/, "\n")
13
- end
14
12
 
13
+ str.encode!("UTF-16", "UTF-8", invalid: :replace, undef: :replace, replace: "")
14
+ str.encode!("UTF-8", "UTF-16").strip.gsub(/[\r\n\f]+/, "\n")
15
+ end
15
16
  end
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module LinkThumbnailer
2
- VERSION = '2.5.1'
2
+ VERSION = '2.5.2'
3
3
  end
@@ -19,25 +19,25 @@ module LinkThumbnailer
19
19
 
20
20
  def size
21
21
  [parser.width, parser.height]
22
- rescue NoMethodError
22
+ rescue NoMethodError, ::OpenURI::HTTPError
23
23
  []
24
24
  end
25
25
 
26
26
  def duration
27
27
  parser.duration
28
- rescue NoMethodError
28
+ rescue NoMethodError, ::OpenURI::HTTPError
29
29
  nil
30
30
  end
31
31
 
32
32
  def provider
33
33
  parser.provider
34
- rescue NoMethodError
34
+ rescue NoMethodError, ::OpenURI::HTTPError
35
35
  nil
36
36
  end
37
37
 
38
38
  def embed_code
39
39
  parser.embed_code
40
- rescue NoMethodError
40
+ rescue NoMethodError, ::OpenURI::HTTPError
41
41
  nil
42
42
  end
43
43
 
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe LinkThumbnailer::Model do
@@ -12,6 +13,13 @@ describe LinkThumbnailer::Model do
12
13
 
13
14
  it { expect(action).to eq(result) }
14
15
 
16
+ context "when string includes utf-8 characters" do
17
+ let(:str) { "中文" }
18
+
19
+ it "should keeps those characters" do
20
+ expect(instance.send(:sanitize, str)).to eq(str)
21
+ end
22
+ end
15
23
  end
16
24
 
17
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: link_thumbnailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pierre-Louis Gottfrois
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2015-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
230
230
  version: '0'
231
231
  requirements: []
232
232
  rubyforge_project:
233
- rubygems_version: 2.2.2
233
+ rubygems_version: 2.4.6
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: Ruby gem ranking images from a given URL returning an object containing images