Fix undefined method for Nil class error.

This commit is contained in:
Guo Xiang Tan 2017-09-28 17:38:53 +08:00
parent 5d53eefcab
commit d79fee9ff3

View File

@ -18,7 +18,11 @@ module Jobs
].map do |url|
if url.present?
url = url.dup
url.gsub!(s3_cdn_hostname, s3_hostname) if s3_cdn_hostname.present?
if s3_cdn_hostname.present? && s3_hostname.present?
url.gsub!(s3_cdn_hostname, s3_hostname)
end
url[base_url] && url[url.index(base_url)..-1]
else
nil