vendor/bundle/ruby/2.6.0/gems/html-pipeline-2.14.1/lib/html/pipeline/camo_filter.rb
# Hijacks images in the markup provided, replacing them with URLs that
# go through the github asset proxy.
Hijacks images in the markup provided, replacing them with URLs that
go through the github asset proxy.
Hijacks images in the markup provided replacing them with URLs that go through the github asset proxy .
def call
        return doc unless asset_proxy_enabled?
        doc.search('img').each do |element|
          original_src = element['src']
          next unless original_src
          begin
            uri = URI.parse(original_src)
          rescue Exception
            next
          end
          next if uri.host.nil?
          next if asset_host_allowed?(uri.host)
          element['src'] = asset_proxy_url(original_src)
          element['data-canonical-src'] = original_src
        end
        doc
      end
def call return doc unless asset_proxy_enabled? doc . search ( 'img' ) . each do | element | original_src = element [ 'src' ] next unless original_src begin uri = URI . parse ( original_src ) rescue Exception next end next if uri . host . nil? next if asset_host_allowed? ( uri . host ) element [ 'src' ] = asset_proxy_url ( original_src ) element [ 'data-canonical-src' ] = original_src end doc end
Hijacks images in the markup provided, replacing them with URLs that
go through the github asset proxy.
Hijacks images in the markup provided replacing them with URLs that go through the github asset proxy .