This project is archived and is in readonly mode.

#813 ✓wontfix
George Deglin

image_tag erroneously appends "." to end of image path

Reported by George Deglin | August 13th, 2008 @ 03:01 AM | in 2.x

Platform: Windows Vista 32bit. Ruby 1.8.6 & JRuby, Rails 2.1.0 Server: WEBbrick

image_tag incorrectly appends "." to the end of an image path, prior to the version timestamp

Ex: image_tag("confident.gif")

Generates an image tag with src: http://server/images/fb_calendar...

Expected: http://server/images/fb_calendar...

The reason for this lies within the behavior of File.exists? on Windows and the following line in the asset_tag_helper:


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

On Windows, appending a "." to the end of a file path will still return the original file. Similarly, File.exist? will return "true" for file paths like "C:/Users/user/application/public/images/emoticons/confident.gif." when the actual path is "C:/Users/user/application/public/images/emoticons/confident.gif". As a result, the above code erroneously appends a "." to the end of image paths when ext nil.

Rails/WEBBrick seem to still return the image correctly for http requests, but JRuby/Rails fails to return the image entirely.

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>

People watching this ticket

Pages