| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Dir.glob can be a security concern. The original use was to provide logic of fallback files. Example a request to `/` should render the file from `/public/index.html`. We can replace the dir glob with the specific logic it represents. The glob {,index,index.html} will look for the current path, then in the directory of the path with index file and then in the directory of the path with index.html. This PR replaces the glob logic by manually checking each potential match. Best case scenario this results in one less file API request, worst case, this has one more file API request.
Related to #16464
Update: added a test for when a file of a given name (`public/bar.html` and a directory `public/bar` both exist in the same root directory. Changed logic to accommodate this scenario.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- don't mutate PATH_INFO in env, test
- test fallback content type matches Rack::File
- change assertion style
- make HTTP_ACCEPT_ENCODING comparison case insensitive
- return gzip path from method instead of true/false so we don't have to assume later
- don't allocate un-needed hash.
Original comments:
https://github.com/rails/rails/commit/
cfaaacd9763642e91761de54c90669a88d772e5a#commitcomment-7468728
cc @jeremy
|
|
|
|
|
|
| |
If someone is using ActionDispatch::Static to serve assets and makes it past the `match?` then the file exists on disk and it will be served. This PR adds in logic that checks to see if the file being served is already compressed (via gzip) and on disk, if it is it will be served as long as the client can handle gzip encoding. If not, then a non gzip file will be served.
This additional logic slows down an individual asset request but should speed up the consumer experience as compressed files are served and production applications should be delivered with a CDN. This PR allows a CDN to cache a gzip file by setting the `Vary` header appropriately. In net this should speed up a production application that are using Rails as an origin for a CDN. Non-asset request speed is not affected in this PR.
|
| |
|
|\
| |
| | |
failure to parse params should trigger a 400 Bad Request
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
We don't actually need a rails.png in the AP fixtures, the tests
that use it don't actually try to load the file.
We also don't need to get rid of it with the dummy reset either.
Finally, it's not needed in the sample application that's included
with the Rails Guides.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When using compute_source_path to determine the full path of an
asset, if our source begins with '/', we don't want to include
the directory. Examples are illustrative:
> compute_source_path("foo", "stylesheets", "css")
=> "/Users/steve/src/my_app/public/stylesheets/foo.css"
> compute_source_path("/foo", "stylesheets", "css")
=> "/Users/steve/src/my_app/public/foo.css"
Before this patch, the second example would return the same as the
first.
Fixes #5680.
|
|
|
|
|
|
| |
Windows doesn't allow `\ / : * ? " < > |` in filenames so create
the fixture files at runtime and ignore the incompatible ones when
running on Windows.
|
|
|
|
|
|
|
|
|
|
|
| |
RFC 3986[1] allows sub-delim characters in path segments unencoded,
however Rack::File requires them to be encoded so we use URI's
unescape method to leave them alone and then escape them again.
Also since the path gets passed to Dir[] we need to escape any glob
characters in the path.
[1]: http://www.ietf.org/rfc/rfc3986.txt
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
An exception will be raised if a local javascript/stylesheet file included
by the stylesheet_link_tag or javascript_include_tag can not be found.
When caching is enabled, we use atomic_write to ensure that the cache file
is not created with zero length.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#2738 state:committed]
|
| |
|
|
|
|
| |
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
|
|
|
|
|
|
| |
be used along with :all. [#480 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
|
| |
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9066 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
|
|
| |
make it easier for plugin developers to inject multiple assets. Closes #10350.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9065 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
|
|
| |
AssetTagHelper#javascript_include_tag [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6164 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5875 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
|
|
| |
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5504 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|
|
javascripts, and images when Action Controller is run under Rails [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4098 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
|