From 52a991536ca161b574df3f94e5ecd11d9a0955e3 Mon Sep 17 00:00:00 2001 From: Martin Ukrop Date: Fri, 13 Sep 2019 22:11:51 +0200 Subject: [PATCH] Add support for Unicode links * In function 'external?', URI is now escaped before split. * This adheres to the recommendation in the URI docs: https://www.rubydoc.info/stdlib/uri/URI.parse * Using CGI.escape instead of URI.escape as the latter is marked obsolete. * Resolves keithmifsud/jekyll-target-blank#33 --- lib/jekyll-target-blank.rb | 2 +- lib/jekyll-target-blank/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-target-blank.rb b/lib/jekyll-target-blank.rb index 0a2dd00..cc499fa 100644 --- a/lib/jekyll-target-blank.rb +++ b/lib/jekyll-target-blank.rb @@ -176,7 +176,7 @@ def mailto_link?(link) # link - a url. def external?(link) if link&.match?(URI.regexp(%w(http https))) - URI.parse(link).host != URI.parse(@site_url).host + URI.parse(CGI.escape(link)).host != URI.parse(CGI.escape(@site_url)).host end end diff --git a/lib/jekyll-target-blank/version.rb b/lib/jekyll-target-blank/version.rb index 3665b54..8dc1dfc 100644 --- a/lib/jekyll-target-blank/version.rb +++ b/lib/jekyll-target-blank/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module JekyllTargetBlank - VERSION = "1.1.1" + VERSION = "1.1.2" end