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:
Michael Koziarski
2008-01-25 04:13:50 +00:00
parent 2168178bdb
commit 9f1fdcc27d
3 changed files with 4 additions and 1 deletions

View File

@@ -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]

View File

@@ -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+$}

View File

@@ -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" />),