This project is archived and is in readonly mode.

#1520 ✓duplicate
David Gero

image_tag has period appended to src attribute

Reported by David Gero | December 5th, 2008 @ 08:28 PM | in 2.x

The change to line 477 in the compute_public_path method of actionpack/lib/action_view/helpers/asset_tag_helper.rb that happened sometime between Rails 2.0 and Rails 2.1 is incorrectly adding a period to the end of source when ext is nil (as in image_tag) but the source exists as a file. This makes image_tag work incorrectly on Tomcat, which will not serve up "foo.jpg.", but will serve up "foo.jpg".

This is a show stopper critical bug in image_tag when running on Tomcat and trying to upgrade from Rails 2.0.2 to Rails 2.1.2

Currently reads:

          source += ".#{ext}" if ext && File.extname(source).blank? || File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}"))

Should read:

          source += ".#{ext}" if ext && (File.extname(source).blank? || File.exist?(File.join(ASSETS_DIR, dir, "#{source}.#{ext}")))

Besides creating a patch, it would be helpful to have a workaround before the next Rails 2.1 release

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket