Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

image_tag has period appended to src attribute

#1520

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

Reported by David Gero · December 5th, 2008 @ 08:28 PM

State: duplicate
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Frederick Cheung
    Frederick Cheung

    Sounds like you've got it figured out, so why don't you create a patch/tests :-)

    December 8th, 2008 @ 10:59 AM

  2. Frederick Cheung
    Frederick Cheung
    • State changed from new to duplicate

    December 12th, 2008 @ 02:14 PM