Skip to content

Commit

Permalink
Include original canonical image src after rewriting
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Jan 13, 2014
1 parent 2550387 commit e0cf905
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/html/pipeline/camo_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def call
next if asset_hostname_whitelisted?(uri.hostname)

element['src'] = asset_proxy_url(uri.to_s)
element['data-canonical-src'] = uri.to_s
end
doc
end
Expand Down
2 changes: 2 additions & 0 deletions test/html/pipeline/camo_filter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def test_camouflaging_http_image_urls
orig = %(<p><img src="http://twitter.com/img.png"></p>)
assert_includes 'img src="' + @asset_proxy_url,
CamoFilter.call(orig, @options).to_s
assert_includes 'data-canonical-src="http://twitter.com/img.png"',
CamoFilter.call(orig, @options).to_s
end

def test_doesnt_rewrite_dotcom_image_urls
Expand Down

0 comments on commit e0cf905

Please sign in to comment.