nokogiri-html-ext 0.2.1 → 0.2.2

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: 63aafc92d00db444d3e8d3ec92817ef8246bd8dd7d66d7d3540d9aac2f55f96b
4
- data.tar.gz: 904f44d50a9fb46c6383abb3e902c1a4166763778c1fe469696cff96c9d1c8a6
3
+ metadata.gz: bcf8d54ec9864f58ba4ada5d6c47e191dbc0063249afb256928bf5fc52f5f0e0
4
+ data.tar.gz: 9c72dacd89707ad6d320e3ed368860b9f58ee73fadb8427a54012fa1c18282a2
5
5
  SHA512:
6
- metadata.gz: 932fbeed6638155ec3033405ea43bf33f9b513e4e2b129ed62c8ef86b483e942ad894421de908e0a1077dd118383faf609b9da4c974a7a4c8a9ef2678ce3436e
7
- data.tar.gz: 073d5a3983516d0bdfd68347ec42474d5c128cef1d7cf5170340d4eea24d334b10dbe5d39acd2fd5462ea1ac3da9b79031d2731db6ea5ad2c8b2fdadcba221b3
6
+ metadata.gz: e589cf7989b82d9b73d265494c537c098a59236c4314cc758fda219e7b908dd0e9f22cb8ead7834def9ce74d27f223468f5394ee071c8be9df98ea391440623c
7
+ data.tar.gz: 3ffd78636127f753fde326de3b20b762a6b678583274425d2d6ad35827c305ab10711a40b1ed927251a4e6040ffa6585b9056161979ffdec0052da26fdbb1963
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.2.2 / 2022-08-20
4
+
5
+ - Improve handling of escaped and invalid URLs (b0d6c75)
6
+
3
7
  ## v0.2.1 / 2022-08-20
4
8
 
5
9
  - Handle escaped URLs and invalid URLs (af78837)
@@ -69,13 +69,15 @@ module Nokogiri
69
69
  #
70
70
  # @return [String]
71
71
  def resolve_relative_url(url)
72
- unescape(
73
- uri_parser.join(*[document.url.strip, base_href, unescape(url)].compact.map { |u| escape(u) })
72
+ url_str = url.to_s
73
+
74
+ uri_parser.unescape(
75
+ uri_parser.join(*[document.url.strip, base_href, url_str].compact.map { |u| uri_parser.escape(u) })
74
76
  .normalize
75
77
  .to_s
76
78
  )
77
79
  rescue URI::InvalidComponentError, URI::InvalidURIError
78
- unescape(url)
80
+ url
79
81
  end
80
82
 
81
83
  # Convert the document's relative URLs to absolute URLs.
@@ -99,10 +101,6 @@ module Nokogiri
99
101
 
100
102
  private
101
103
 
102
- def escape(url)
103
- uri_parser.escape(url.to_s)
104
- end
105
-
106
104
  def resolve_relative_urls_for(attributes_map)
107
105
  attributes_map.each do |attribute, names|
108
106
  xpaths = names.map { |name| "//#{name}[@#{attribute}]" }
@@ -113,10 +111,6 @@ module Nokogiri
113
111
  end
114
112
  end
115
113
 
116
- def unescape(url)
117
- uri_parser.unescape(url.to_s)
118
- end
119
-
120
114
  def uri_parser
121
115
  @uri_parser ||= URI::DEFAULT_PARSER
122
116
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Nokogiri
4
4
  module HTMLExt
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri-html-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Garber
@@ -44,7 +44,7 @@ licenses:
44
44
  - MIT
45
45
  metadata:
46
46
  bug_tracker_uri: https://github.com/jgarber623/nokogiri-html-ext/issues
47
- changelog_uri: https://github.com/jgarber623/nokogiri-html-ext/blob/v0.2.1/CHANGELOG.md
47
+ changelog_uri: https://github.com/jgarber623/nokogiri-html-ext/blob/v0.2.2/CHANGELOG.md
48
48
  rubygems_mfa_required: 'true'
49
49
  post_install_message:
50
50
  rdoc_options: []