Skip to content

Commit

Permalink
Another fix related to #161
Browse files Browse the repository at this point in the history
We should escape the URI that's the target of the webmention as well.
  • Loading branch information
fancypantalons committed Nov 27, 2021
1 parent 10684c0 commit 65efd7d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/jekyll/commands/webmention.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,19 @@ def self.process(_args = [], options = {})
target = "http:#{target}"
end

# produce an escaped version of the target (in case of special
# characters, etc).
escaped = URI::Parser.new.escape(target);

# skip bad URLs
next unless WebmentionIO.uri_ok?(target)
next unless WebmentionIO.uri_ok?(escaped)

# get the endpoint
endpoint = WebmentionIO.get_webmention_endpoint(target)
endpoint = WebmentionIO.get_webmention_endpoint(escaped)
next unless endpoint

# get the response
response = WebmentionIO.webmention(source, target, endpoint)
response = WebmentionIO.webmention(source, escaped, endpoint)
next unless response

# capture JSON responses in case site wants to do anything with them
Expand Down

0 comments on commit 65efd7d

Please sign in to comment.