Permalink
Browse files

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
  • Loading branch information...
1 parent 2168178 commit 9f1fdcc27d689fc5feb07a6f197856a710383319 @NZKoz NZKoz committed Jan 25, 2008
View
@@ -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 @@ def image_tag(source, options = {})
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 @@ def teardown
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" />),

0 comments on commit 9f1fdcc

Please sign in to comment.