mirror of
https://github.com/github/rails.git
synced 2026-02-03 18:55:29 -05:00
Handle corner case with image_tag when passed 'messed up' image names. Closes #9018 [duncanbeevers, mpalmer]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8717 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Handle corner case with image_tag when passed 'messed up' image names. #9018 [duncanbeevers, mpalmer]
|
||||
|
||||
* Add label_tag helper for generating elements. #10802 [DefV]
|
||||
|
||||
* Introduce TemplateFinder to handle view paths and lookups. #10800 [Pratik Naik]
|
||||
|
||||
@@ -398,7 +398,7 @@ module ActionView
|
||||
options.symbolize_keys!
|
||||
|
||||
options[:src] = path_to_image(source)
|
||||
options[:alt] ||= File.basename(options[:src], '.*').split('.').first.capitalize
|
||||
options[:alt] ||= File.basename(options[:src], '.*').split('.').first.to_s.capitalize
|
||||
|
||||
if size = options.delete(:size)
|
||||
options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$}
|
||||
|
||||
@@ -131,6 +131,7 @@ class AssetTagHelperTest < Test::Unit::TestCase
|
||||
|
||||
ImageLinkToTag = {
|
||||
%(image_tag("xml.png")) => %(<img alt="Xml" src="/images/xml.png" />),
|
||||
%(image_tag("..jpg")) => %(<img alt="" src="/images/..jpg" />),
|
||||
%(image_tag("rss.gif", :alt => "rss syndication")) => %(<img alt="rss syndication" src="/images/rss.gif" />),
|
||||
%(image_tag("gold.png", :size => "45x70")) => %(<img alt="Gold" height="70" src="/images/gold.png" width="45" />),
|
||||
%(image_tag("gold.png", "size" => "45x70")) => %(<img alt="Gold" height="70" src="/images/gold.png" width="45" />),
|
||||
|
||||
Reference in New Issue
Block a user