Skip to content

Instantly share code, notes, and snippets.

@radar
Created June 16, 2013 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save radar/5793814 to your computer and use it in GitHub Desktop.
Save radar/5793814 to your computer and use it in GitHub Desktop.
irb(main):001:0> helper.image_tag("HTTP://google.com")
=> "<img alt=\"Google\" src=\"/assets/HTTP://google.com\" />"
irb(main):002:0> helper.image_tag("http://google.com")
=> "<img alt=\"Google\" src=\"http://google.com\" />"
@rkh
Copy link

rkh commented Jun 16, 2013

I like how it both has the same alt attribute.

@pmarreck
Copy link

The source for it is pretty damn basic, though:

https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/asset_tag_helper.rb#L198

The real culprit seems to be this

https://github.com/rails/rails/blob/master/actionpack/lib/action_view/helpers/asset_url_helper.rb#L108

although it appears to have been modified extremely recently
8fc34276 (David Celis 2013-06-16 16:57:49 -0700 108) URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//}i
"davidcelis 14 hours ago Use a case insensitive URI Regexp for #asset_path"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment