This project is archived and is in readonly mode.
AssetIncludeTag ensures that files are in the wrong directory
Reported by Henning | November 19th, 2010 @ 05:15 PM
javascript_include_tag
and
stylesheet_link_tag
check that the included paths
actually exist as files. Under certain circumstances this check is
performed in the wrong directory and an error is raised even though
all files exist.
The circumstances that expose this issue are:
- The included paths are named paths like
'script.js'
(instead of:all
) - The asset tag helper is called with the
:cache => true
option config.perform_caching
is set tofalse
- The application is running with a relative URL root ("sub-URI deployment")
The error that the paths correctly prefixed by the relative URL root are also used to check the files' existence. Since a path prefixed that way is a virtual path that does not exist in the local file system, that check fails.
My proposed fix is that paths used to check file existence should not be prefixed by the relative URL root. I will upload a patch with tests for this.
Steps to reproduce:
- Configure a Passenger application with
RackBaseURI /sub-folder
- In the active application environment, set
config.perform_caching = false
- In any view link to an existing javascript file:
<%= javascript_include_tag 'script.js', :cache => true %><br/>
- Open that view in the browser
- You will see the follow error:
No such file or directory - Asset file not found at '/home/username/rails-project/public/sub-folder/javascripts/script.js'
Comments and changes to this ticket
-
Repository November 19th, 2010 @ 05:56 PM
- State changed from new to resolved
(from [deff5289474d966bb12ae18c1b816df3eeb11f27]) Fix AssetIncludeTag ensuring that files are in the wrong directory [#6015 state:resolved]
Signed-off-by: Santiago Pastorino santiago@wyeworks.com
https://github.com/rails/rails/commit/deff5289474d966bb12ae18c1b816...
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
Attachments
Referenced by
- 6015 AssetIncludeTag ensures that files are in the wrong directory (from [deff5289474d966bb12ae18c1b816df3eeb11f27]) Fix Ass...