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 erroneously appends "." to end of image path

#813

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.

Reported by George Deglin · August 13th, 2008 @ 03:01 AM

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

Activity

  1. josh
    josh
    • State changed from new to wontfix

    Got unit tests?

    November 22nd, 2008 @ 07:35 PM