. (DOT) appended to image_tag? Double-U TF!!

Hey guys,

some funny stuff is going on.

image_tag 'items/1.png' # => <IMG alt="1" src="/images/items/1.png." /> <-- Note the . (DOT) !

image_tag 'items/1.jpg' # => <IMG alt="1" src="/images/items/1.jpg" /> <-- no Dot

Does anyone have an idea whats going on here?

Uuuuhhmm... Help please :slight_smile:

Cheers, Stefan

image_tag 'items/1.abcd' # => <IMG alt="1" src="/images/items/1.abcd" />

As it seems the dot is only added to files that physically exist.

Maybe you overloaded image_tag method somewhere in your helpers?

Version of rails?

Ryan Bigg wrote:

Version of rails?

2.1.0

So I just set up an empty project again. With only one controller. Tested it on IIS with FastCGI, Webrick and Mongrel

<%= image_tag "rails.png" %> #=> <img alt="Rails" src="/images/rails.png.?1218802201" />

Setting ENV["RAILS_ASSET_ID"] = '' produces #=> <img alt="Rails" src="/images/rails.png." />

Its giving me a real headache

Ryan Bigg wrote:

Version of rails?

Well the guilty line is

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

(asset_tag_helper.rb line 489; in this particular case ext will be nil
and source will be foo.png, dir will be images)

Fred

Frederick Cheung wrote:

Ryan Bigg wrote:

Version of rails?

Well the guilty line is

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

(asset_tag_helper.rb line 489; in this particular case ext will be nil and source will be foo.png, dir will be images)

Fred

Seems to me like a bug in Ruby. See:

File.exist?(File.join(RAILS_ROOT,'public/images/','rails.png')) => true

File.exist?(File.join(RAILS_ROOT,'public/images/','rails.png.')) => true

File.exist?(File.join(RAILS_ROOT,'public/images/','rails.pngoops')) => false

Frederick Cheung wrote:

Ryan Bigg wrote:

Version of rails?

Well the guilty line is

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

(asset_tag_helper.rb line 489; in this particular case ext will be
nil and source will be foo.png, dir will be images)

Fred

Seems to me like a bug in Ruby. See:

File.exist?(File.join(RAILS_ROOT,'public/images/','rails.png')) => true

Doesn't happen with my ruby (on a mac)

Fred

Frederick Cheung wrote:

Well something like File.exist? lying to you is going to be annoying to workaround. I'd probably try and workout why it's doing that. A simple fix might be to avoid image_tag for now.

Fred

Frederick Cheung wrote: