gitlab-org--gitlab-foss/spec/lib/gitlab/middleware
Stan Hu 7d28e39f58 Fix multipart attachments not uploading
Mixing and matching the use of Rack::Request and ActionDispatch::Request
in Rails 5 is bad, particularly if you have middleware that
manipulates or accesses environment variables.

`Gitlab::Middleware::Multipart` attempts to rewrite request parameters
to the proper values (e.g. replacing `data_file` with
`UploadedFile`). It does this by calling `Rack::Request#update_params`,
which essentially updates `env['rack.request.form_hash']`.

By changing to `ActionDispatch::Request`, the Go middleware was causing
the request parameters to be stored inside
`env['action_dispatch.request.request_parameters']`. Later calls to
`Rack::Request#update_params` would not have any effect because it would
attempt to update `env['rack.request.form_has']` instead of
`env['action_dispatch.request.request_parameters']`. As a result, the
controller still saw the old parameters.

Since the Go middleware appears to be using `ActionDispatch::Request`
for authorization methods, we can switch the multipart middleware to
use it too.

Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/9035
2019-01-05 01:56:47 -08:00
..
basic_health_check_spec.rb Use /-/health instead of breaking /-/liveness 2018-07-28 14:35:02 -07:00
go_spec.rb Fix lint errors 2019-01-03 20:28:02 +08:00
multipart_spec.rb Fix multipart attachments not uploading 2019-01-05 01:56:47 -08:00
rails_queue_duration_spec.rb
read_only_spec.rb Remove deprecated ActionDispatch::ParamsParser 2018-12-16 10:47:24 +01:00
release_env_spec.rb Move constants and update for feedback 2018-03-03 00:39:42 +08:00