Skip to content

Commit

Permalink
Fix escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
ngs committed May 31, 2020
1 parent fc146f7 commit 5d63612
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/middleman-ogp/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def ogp_tags(&block) # rubocop:disable all
end
if Middleman::OGP::Helper.auto.include?('url') &&
Middleman::OGP::Helper.base_url
opts[:og][:url] = URI.join(Middleman::OGP::Helper.base_url, URI.encode_www_form(current_resource.url))
opts[:og][:url] = URI.join(Middleman::OGP::Helper.base_url, current_resource.url)
end

Middleman::OGP::Helper.ogp_tags(opts) do |name, value|
Expand Down Expand Up @@ -162,7 +162,7 @@ def self.og_tag(key, obj = nil, prefix = 'og', &block) # rubocop:disable Metrics
name = [prefix].concat(key).join(':')
value = obj.to_s
if Middleman::OGP::Helper.image_base_url && name == 'og:image' && !%r{^https?://}.match(value)
value = URI.join(Middleman::OGP::Helper.image_base_url, URI.encode_www_form(value))
value = URI.join(Middleman::OGP::Helper.image_base_url, value)
end
block.call name, value
end
Expand Down

0 comments on commit 5d63612

Please sign in to comment.