onebox 2.2.16 → 2.2.17

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
  SHA256:
3
- metadata.gz: c57e1039d85f6005208f898053d0b2310eeb7f1e6fc4b2fc3f1281f41489585d
4
- data.tar.gz: 354950404fa80f8eeeea21b1193647ce61ae6bc32d97c1400ed82095fd8f8355
3
+ metadata.gz: 3244779d201e9c64cb43a00dccfa5f189078c7b6b3523b3d262248a10bb9a4e1
4
+ data.tar.gz: c54ca691f2fc452e0a3d7865a91542f7214c2a430fd4959f8c825866f5bb18c4
5
5
  SHA512:
6
- metadata.gz: b5a7f2ea81cce57035c904afd2c893db32b98c7768ab69f810b2183a0330c43f2af655e6670116463566d1cc2248d592db04983be1b129148551f5e4ca303702
7
- data.tar.gz: 4840463df258379f8e0838c0ad7d4dc320b2706d85e260ed962342b9d40a3b2872b69e40e9ba9667ead20f48ba39a321352f182a306240db871508d12db0d2ea
6
+ metadata.gz: 3b36800f1d49b5c3eb0c6a8a81b06bf123bc5a051851576a41c3db4ebd4335bde92b60f34d5d674a4c34305c4197d42b09420cc9ecd940c36c2fbff950022fb5
7
+ data.tar.gz: 40f6f44ff3c4f7593e473260f26effeac3047e3342aad0d3e6264f83dc0fb9d45551342a8682323f5629a4944a89d4de0178f92f526766a7edb1b5aa535c717f
@@ -26,23 +26,7 @@ module Onebox
26
26
 
27
27
  def self.fetch_html_doc(url, headers = nil, body_cacher = nil)
28
28
  response = (fetch_response(url, headers: headers, body_cacher: body_cacher) rescue nil)
29
- doc = Nokogiri::HTML(response)
30
- uri = Addressable::URI.parse(url)
31
-
32
- ignore_canonical_tag = doc.at('meta[property="og:ignore_canonical"]')
33
- should_ignore_canonical = IGNORE_CANONICAL_DOMAINS.map { |hostname| uri.hostname.match?(hostname) }.any?
34
-
35
- unless (ignore_canonical_tag && ignore_canonical_tag['content'].to_s == 'true') || should_ignore_canonical
36
- # prefer canonical link
37
- canonical_link = doc.at('//link[@rel="canonical"]/@href')
38
- canonical_uri = Addressable::URI.parse(canonical_link)
39
- if canonical_link && "#{canonical_uri.host}#{canonical_uri.path}" != "#{uri.host}#{uri.path}"
40
- response = (fetch_response(canonical_uri.to_s, headers: headers, body_cacher: body_cacher) rescue nil)
41
- doc = Nokogiri::HTML(response) if response
42
- end
43
- end
44
-
45
- doc
29
+ Nokogiri::HTML(response)
46
30
  end
47
31
 
48
32
  def self.fetch_response(location, redirect_limit: 5, domain: nil, headers: nil, body_cacher: nil)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onebox
4
- VERSION = "2.2.16"
4
+ VERSION = "2.2.17"
5
5
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.16
4
+ version: 2.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
8
8
  - Vyki Englert
9
9
  - Robin Ward
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-06-22 00:00:00.000000000 Z
13
+ date: 2021-07-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: addressable
@@ -407,7 +407,7 @@ homepage: https://github.com/discourse/onebox
407
407
  licenses:
408
408
  - MIT
409
409
  metadata: {}
410
- post_install_message:
410
+ post_install_message:
411
411
  rdoc_options: []
412
412
  require_paths:
413
413
  - lib
@@ -423,7 +423,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
423
423
  version: '0'
424
424
  requirements: []
425
425
  rubygems_version: 3.0.3
426
- signing_key:
426
+ signing_key:
427
427
  specification_version: 4
428
428
  summary: A gem for generating embeddable HTML previews from URLs.
429
429
  test_files: []