Skip to content

Commit

Permalink
Handle corner case with image_tag when passed 'messed up' image names.
Browse files Browse the repository at this point in the history
…Closes #9018 [duncanbeevers, mpalmer]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8717 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
NZKoz committed Jan 25, 2008
1 parent 2168178 commit 9f1fdcc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/asset_tag_helper.rb
Expand Up @@ -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+$}
Expand Down
1 change: 1 addition & 0 deletions actionpack/test/template/asset_tag_helper_test.rb
Expand Up @@ -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" />),
Expand Down

0 comments on commit 9f1fdcc

Please sign in to comment.