This project is archived and is in readonly mode.

#693 ✓duplicate
iGEL

image_tag adds strange dot after file names on windows

Reported by iGEL | July 24th, 2008 @ 04:33 PM | in 2.x

On Windows, File#exist?("example.txt.") returns true, if example.txt exists (note the dot at the end). Because of that, methods like image_tag add a dot at the end of the file name.

Fix:

Change actionpack/lib/action_view/helpers/asset_tag_helper.rb:477 from:

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

to:

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

Lots of assertions failed because of this in my app when I migrated from 1.2.6 to 2.1.0

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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages