This project is archived and is in readonly mode.
asset_tag_helper.rb expression bug in compute_public_path
-
madlep
I had exactly the same problem at about the same time.
Problem occurs for me using JRuby 1.1.4 and MRI 1.8.7 on Windows XP, but was fine using both on OS X Leopard.
Seems the behaviour of File.exist? is different on different OSes in regard to handling file names with a trailing space - as compute_public_path does.
I struct this when #image_tag called as image_tag("myimage.png") would generate an img tag with a src attribute of "/images/myimage.png.?1142164270" (note the extra . after png). This only occurs on windows.
I only noticed this because a couple of other devs were running on WEBrick for development, and this refuses to serve up the image. Mongrel seems fine with it though.
-
madlep
*oops, I mean "trailing full stop" as opposed to "trailing space" in previous comment - which compute_public_path tries if ext is nil (as it is in the case of when compute_public_path is called as part of image_tag
-
madlep
- Tag changed from 2.1, actionpack, bug to 2.1, actionpack, action_view, bug, patch
patch attached that incorporates mctozzy's fix with tests.
Basically the root cause is a bug with the precedence ordering in #missing_extension? when #image_tag is called.
The logic should never do the other checks if the extension is nil (as it is in the case of image_tag), but with the existing code it was. This produced an incorrect image URL when running rails on Windows due to a quirk with the way windows handles File.exist? for file names ending with a "."
-
Repository
- State changed from new to resolved
(from [8e50f0f96ef53ee8cc7ffa86ce0e71cc357b2b6c]) Fix image_tag behavior on windows. [#1085 asset_tag_helper.rb expression bug in compute_public_path state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
