diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-02 08:35:12 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-10-02 08:35:12 +0000 |
commit | 664cd27faa6082d3b67e39aec7931cb6a7579031 (patch) | |
tree | eada2ade27136b39c5d5188bc4de7dfdb26849c7 /lib | |
parent | 209d7575b63ed889036707eea0183c1ff4bfd67d (diff) | |
parent | 3040b994df0de7b6a6c4159a887fe7c8733bbb4d (diff) | |
download | gitlab-ce-664cd27faa6082d3b67e39aec7931cb6a7579031.tar.gz |
Merge branch '38571-fix-exception-in-raven-report' into 'master'
Ensure no exception is raised when Raven tries to get the current user in API context
Closes #38571
See merge request gitlab-org/gitlab-ce!14580
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/helpers.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 1e8475ba3ec..4964a76bef6 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -464,10 +464,12 @@ module API header(*Gitlab::Workhorse.send_artifacts_entry(build, entry)) end - # The Grape Error Middleware only has access to env but no params. We workaround this by - # defining a method that returns the right value. + # The Grape Error Middleware only has access to `env` but not `params` nor + # `request`. We workaround this by defining methods that returns the right + # values. def define_params_for_grape_middleware - self.define_singleton_method(:params) { Rack::Request.new(env).params.symbolize_keys } + self.define_singleton_method(:request) { Rack::Request.new(env) } + self.define_singleton_method(:params) { request.params.symbolize_keys } end # We could get a Grape or a standard Ruby exception. We should only report anything that |