Skip to content

Commit

Permalink
Fix a mistake in regular expression
Browse files Browse the repository at this point in the history
  • Loading branch information
noellabo committed Jul 13, 2019
1 parent 1d6b9df commit c5b58f7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/link_thumbnailer/response.rb
Expand Up @@ -18,8 +18,8 @@ def body

def extract_charset
content_type = @response['Content-Type'] || ''
m = content_type.match(/charset=(\w+)/)
(m && m[1]) || @response.body.scrub =~ /<meta[^>]*charset\s*=\s*["']?(.+)["']/i && $1.upcase || ''
m = content_type.match(/charset=([\w-]+)/)
(m && m[1]) || @response.body.scrub =~ /<meta[^>]*charset\s*=\s*["']?(.+?)["' >]/i && $1 || ''
end

def extract_body
Expand Down

0 comments on commit c5b58f7

Please sign in to comment.