| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).
Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).
That cop and enforced style will reduce the our code review cost.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
as it is
Since #35709, `Response#conten_type` returns only MIME type correctly.
It is a documented behavior that this method only returns MIME type, so
this change seems appropriate.
https://github.com/rails/rails/blob/39de7fac0507070e3c5f8b33fbad6fced84d97ed/actionpack/lib/action_dispatch/http/response.rb#L245-L249
But unfortunately, some users expect this method to return all
Content-Type that does not contain charset. This seems to be breaking
changes.
We can change this behavior with the deprecate cycle.
But, in that case, a method needs that include Content-Type with
additional parameters. And that method name is probably the
`content_type` seems to properly.
So I changed the new behavior to more appropriate `media_type` method.
And `Response#content_type` changed (as the method name) to return Content-Type
header as it is.
Fixes #35709.
[Rafael Mendonça França & Yuuji Yaginuma ]
|
| |
|
|\
| |
| |
| | |
Return parameters enumerator from transform_keys/!
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously calling `ActionController::Parameters#transform_keys/!`
without passing a block would return an enumerator for the underlying
hash, which was inconsistent with the behaviour when a block was passed:
ActionController::Parameters.new(foo: "bar").transform_keys { |k| k }
=> <ActionController::Parameters {"foo"=>"bar"} permitted: false>
ActionController::Parameters.new(foo: "bar").transform_keys.each { |k| k }
=> {"foo"=>"bar"}
An enumerator for the parameters is now returned instead, ensuring that
evaluating it produces another parameters object instead of a hash:
ActionController::Parameters.new(foo: "bar").transform_keys.each { |k| k }
=> <ActionController::Parameters {"foo"=>"bar"} permitted: false>
|
|
|
|
|
|
|
|
|
|
| |
test for non-numeric key in nested attributes
test: extra blank line between tests removed
test for non-numeric key fixed (by Daniel)
Update according to feedback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The instrumentation proxy adds three stack frames per-middleware, even
when nothing is listening.
This commit, when the middleware stack is built, only adds
instrumentation when the `process_middleware.action_dispatch` event has
already been subscribed to.
The advantage to this is that we don't have any extra stack frames in
apps which don't need middleware instrumentation.
The disadvantage is that the subscriptions need to be in place when the
middleware stack is built (during app boot). I think this is likely okay
because temporary AS::Notifications subscriptions are strongly
discouraged.
|
|
|
|
|
|
|
| |
Because controllers' `perform_caching` config is `true` by default, it
means we actually enable the caching in all those tests implicitly (and
it works). Which also means we can avoid repeatedly declaring that and
just specify it once in the setup method (just for declaration).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, when using `render file:`, it was possible to render files
not only at an absolute path or relative to the current directory, but
relative to ANY view paths. This was probably done for absolutely
maximum compatibility when addressing CVE-2016-0752, but I think is
unlikely to be used in practice.
Tihs commit removes the ability to `render file:` with a path relative
to a non-fallback view path.
Make FallbackResolver.new private
To ensure nobody is making FallbackResolvers other than "/" and "".
Make reject_files_external_... no-op for fallbacks
Because there are only two values used for path: "" and "/", and
File.join("", "") == File.join("/", "") == "/", this method was only
testing that the absolute paths started at "/" (which of course all do).
This commit doesn't change any behaviour, but it makes it explicit that
the FallbackFileSystemResolver works this way.
Remove outside_app_allowed argument
Deprecate find_all_anywhere
This is now equivalent to find_all
Remove outside_app argument
Deprecate find_file for find
Both LookupContext#find_file and PathSet#find_file are now equivalent to
their respective #find methods.
|
| |
|
|\
| |
| | |
RFC: Introduce Template::File
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The previous behaviour of render file: was essentially the same as
render template:, except that templates can be specified as an absolute
path on the filesystem.
This makes sense for historic reasons, but now render file: is almost
exclusively used to render raw files (not .erb) like public/404.html. In
addition to complicating the code in template/resolver.rb, I think the
current behaviour is surprising to developers.
This commit deprecates the existing "lookup a template from anywhere"
behaviour and replaces it with "render this file exactly as it is on
disk". Handlers will no longer be used (it will render the same as if
the :raw handler was used), but formats (.html, .xml, etc) will still be
detected (and will default to :plain).
The existing render file: behaviour was the path through which Rails
apps were vulnerable in the recent CVE-2019-5418. Although the
vulnerability has been patched in a fully backwards-compatible way, I
think it's a strong hint that we should drop the existing
previously-vulnerable behaviour if it isn't a benefit to developers.
|
|/
|
|
|
|
| |
.all isn't a valid file extension, so it shouldn't used as a symbol.
This also makes Mime::ALL better match how */* is parsed from an Accept
header.
|
| |
|
|
|
|
|
| |
This test was trying to set the exception_app in the wrapper proxy
instead in the middleware itself.
|
| |
|
|
|
|
|
| |
[CVE-2019-5418]
[CVE-2019-5419]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit passes the template format to the digestor in order to come
up with a key. Before this commit, the digestor would depend on the
side effect of the template renderer setting the rendered_format on the
lookup context. I would like to remove that mutation, so I've changed
this to pass the template format in to the digestor.
I've introduced a new instance variable that will be alive during a
template render. When the template is being rendered, it pushes the
current template on to a stack, setting `@current_template` to the
template currently being rendered. When the cache helper asks the
digestor for a key, it uses the format of the template currently on the
stack.
|
|
|
|
| |
I would like to add those tests to prevent regression.
|
|\
| |
| | |
Revert ensure external redirects are explicitly allowed
|
| | |
|
|\ \
| |/
|/| |
Template Handler Refactoring
|
| | |
|
| |
| |
| |
| | |
Now that secret_token was removed all this code is now dead.
|
| |
| |
| |
| | |
`combined_fragment_cache_key`
|
| |
| |
| |
| | |
Add `fallback_location` and `allow_other_host` options to `redirect_to`.
|
|/
|
|
|
|
|
|
|
|
|
| |
This reverts commit e385e4678fc64be6e176c3bdac6641db9fe48d85.
While this option was undocumented it exists to make possible to pass
parameters to the route helpers that are reserved like `:domain`.
While `url_for(domain: 'foo.com')` would generate a URL in the `foo.com`
domain `url_for(params: { domain: 'foo.com' })` would generate a URL
with `?domain=foo.com`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Enable `Lint/UselessAssignment` cop to avoid unused variable warnings
Since we've addressed the warning "assigned but unused variable"
frequently.
370537de05092aeea552146b42042833212a1acc
3040446cece8e7a6d9e29219e636e13f180a1e03
5ed618e192e9788094bd92c51255dda1c4fd0eae
76ebafe594fc23abc3764acc7a3758ca473799e5
And also, I've found the unused args in c1b14ad which raises no warnings
by the cop, it shows the value of the cop.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since #30367, if `no-cache` includes Cache-Control headers, special keys
like `public`, `must-revalidate` are ignored.
But in my understanding, `public` still need in case of want to cache
authenticated pages.
The authenticated pages to be cacheable, but still authenticated for
every user, need to specify the `Cache-Control: public, no-cache`.
For keys other than `public`, I did not know the case where it was
necessary to use it in combination with `no-cache`, so I fixed that can
be used only for `public`.
Ref: https://www.mnot.net/cache_docs/#CACHE-CONTROL
Fixes #34780.
|
|
|
| |
If Basecamp is a Facebook-free business, then Rails should be Facebook-free framework.
|
|
|
|
| |
These were unused since 11af089cee0a0e744e267d32becfe2c66a586d31 and e35b98e6f5c54330245645f2ed40d56c74538902.
|
|
|
|
|
|
|
|
|
|
| |
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).
I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
|
|
|
|
|
|
| |
since Ruby 2.5
https://bugs.ruby-lang.org/issues/14133
|
|
|
|
|
|
|
|
|
|
|
|
| |
This takes away the following log.
```
Error occurred while parsing request parameters.
Contents:
{:foo=>"heyo"}
```
Pass the correct value as JSON
|
|\
| |
| | |
Allow nil params on controller HTTP test methods
|
| | |
|
|/
|
|
|
| |
Just testing that `after_action` is invoked before
`prepend_after_action`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
… by switching the initialzation of an appropriate response parser
in `ActionDispatch::TestResponse` from eagerly to lazily.
By doing so, the response parser can be correctly set for
`ActionController::TestCase`, which doesn't include
the content type header in the constructor but only sets it at
a later time.
Fixes #34676.
|
|\
| |
| |
| | |
:only and :except are now chained for routing resource(s)
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Allow chaining the :only and :except options for routing resource(s).
Previously, the following yielded routes for both show and destroy:
resource :account, :only => [:show, :destroy], :except => :destroy
This now yields only the show action. This chaining can be useful for
passing optional :except options to code that makes use of the :only
option (e.g. for a gem with its own routing methods).
|
| |
| |
| |
| | |
[Gannon McGibbon + Josh Cheek]
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
this method (#34210)
* Fix `ActionController::Parameters#each_value`
`each_value` should yield with "value" of the params instead of "value" as an array.
Related to #33979
* Add changelog entry about `ActionController::Parameters#each_value`.
Follow up #33979
|
| |
| |
| |
| |
| |
| |
| | |
Until #34050 can be resolved
This reverts commit 7f870a5ba2aa9177aa4a0e03a9d027928ba60e49, reversing
changes made to 6556898884d636c59baae008e42783b8d3e16440.
|
|\ \
| | |
| | |
| | | |
Don't handle params option in a special way in url_for helper
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since Rails 6.0 will support Ruby 2.4.1 or higher
`# frozen_string_literal: true` magic comment is enough to make string object frozen.
This magic comment is enabled by `Style/FrozenStringLiteralComment` cop.
* Exclude these files not to auto correct false positive `Regexp#freeze`
- 'actionpack/lib/action_dispatch/journey/router/utils.rb'
- 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb'
It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333
Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed.
* Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required
- 'actionpack/test/controller/test_case_test.rb'
- 'activemodel/test/cases/type/string_test.rb'
- 'activesupport/lib/active_support/core_ext/string/strip.rb'
- 'activesupport/test/core_ext/string_ext_test.rb'
- 'railties/test/generators/actions_test.rb'
|
|\ \ \
| | | |
| | | | |
Added ActionController::Parameters.each_value methods
|