Fix bug.
This commit is contained in:
parent
64e26d9e2e
commit
04da5dfc7e
|
@ -73,9 +73,13 @@ class AdImage
|
|||
def youtube_thumb
|
||||
uri = URI.parse(self.youtube) rescue nil
|
||||
if !uri.nil? && uri.host == "www.youtube.com"
|
||||
params = CGI.parse(uri.query)
|
||||
v = params['v'].first
|
||||
return "http://img.youtube.com/vi/#{v}/0.jpg"
|
||||
params = CGI.parse(uri.query) rescue {}
|
||||
if params.has_key?('v')
|
||||
v = params['v'].first
|
||||
return "http://img.youtube.com/vi/#{v}/0.jpg"
|
||||
else
|
||||
return ""
|
||||
end
|
||||
else
|
||||
return ""
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue