Skip to content

Commit bd60091

Browse files
committed
Resolve relative URLs in parsed document
…which means there’s no need to do it in the `#matches` method.
1 parent 70b8001 commit bd60091

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/indieweb/endpoints/parser.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ def initialize(response)
1616
#
1717
# @raise [InvalidURIError]
1818
def matches(identifier, node_names: ["link"])
19-
results =
20-
(matches_from_headers(identifier) + matches_from_body(identifier, node_names))
21-
.compact
22-
.map! { |endpoint| response.uri.join(endpoint).to_s }
19+
results = (matches_from_headers(identifier) + matches_from_body(identifier, node_names)).compact
2320

2421
results.uniq!
2522
results.sort!
@@ -56,7 +53,7 @@ def to_h
5653

5754
# @return [Nokogiri::HTML5::Document]
5855
def body
59-
@body ||= Nokogiri::HTML5(response.body)
56+
@body ||= Nokogiri::HTML5(response.body, response.uri).resolve_relative_urls!
6057
end
6158

6259
# @return [Hash{Symbol => Array<LinkHeaderParser::LinkHeader>}]

0 commit comments

Comments
 (0)