rollbar 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9654ef4b39ccff0c61d5829b0ed24cf4fe8358ff
4
- data.tar.gz: b966e415ba2c051cef36b0b7fad7c5ce5f3e2b9c
3
+ metadata.gz: 553381499b916556da8272eadf551847254ffcaa
4
+ data.tar.gz: c80b393ccaa1cb9e2c2d46646703510852965ecf
5
5
  SHA512:
6
- metadata.gz: 63715716194409340fd44702f874148a7a22f490eb86cf947a62f3bb5429f55f6891d055f056f4e17cdd3356412c7071d0d4bd4ca17900328ff7c4f2d7198ce7
7
- data.tar.gz: 8834975d7fed4de30c536664589d600d1647fe79e106f3c05e7674a7414009eecf0eccf97c768e387622950c27a256626e3ad575b8680876ac3fdc0b6ca6f4ae
6
+ metadata.gz: d31b2d8d6d71c30c5888c3dacd631cda2f584d2de6a8b4cb238ca8c484a7037745904cfa5925ea5eca5e2100a93afa8c56681deab6292ffeefd97d4a764b078d
7
+ data.tar.gz: eedb32f0cc342297fbb7c48f989b8568bb6856ee385bc8f5d65c7d95334f58ed0a3121511d5824c870ddb1545e94fe8f2c265435a1afeb458730f2a2d927d581
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.1.2
4
+
5
+ Bug fix:
6
+
7
+ - Allow having multiple uploads for the same parameter. Thanks @mdominiak.
8
+
3
9
  ## 2.1.1
4
10
 
5
11
  Bug fix:
data/Gemfile CHANGED
@@ -1,20 +1,16 @@
1
- source 'https://rubygems.org'
1
+ # This file was generated by Appraisal
2
2
 
3
- gemspec
4
-
5
- gem 'sqlite3', :platform => [:ruby, :mswin, :mingw]
6
- gem 'jruby-openssl', :platform => :jruby
7
- gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
8
- gem 'appraisal'
3
+ source "https://rubygems.org"
9
4
 
10
- gem 'rubysl', '~> 2.0', :platform => :rbx
11
- gem 'racc', :platform => :rbx
12
- gem 'minitest', :platform => :rbx
13
- gem 'rubysl-test-unit', :platform => :rbx
14
- gem 'rubinius-developer_tools', :platform => :rbx
5
+ gem "sqlite3", :platform => [:ruby, :mswin, :mingw]
6
+ gem "jruby-openssl", :platform => :jruby
7
+ gem "activerecord-jdbcsqlite3-adapter", :platform => :jruby
8
+ gem "appraisal"
9
+ gem "rubysl", "~> 2.0", :platform => :rbx
10
+ gem "racc", :platform => :rbx
11
+ gem "minitest", :platform => :rbx
12
+ gem "rubinius-developer_tools", :platform => :rbx
13
+ gem "rails", "4.2.3"
15
14
 
16
- if RUBY_VERSION.chars.first.to_i > 1
17
- gem 'byebug'
18
- else
19
- gem 'debugger'
20
- end
15
+ gemspec
16
+ gem 'byebug'
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.1.1)](https://travis-ci.org/rollbar/rollbar-gem/branches)
1
+ # Rollbar notifier for Ruby [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=v2.1.2)](https://travis-ci.org/rollbar/rollbar-gem/branches)
2
2
 
3
3
  <!-- RemoveNext -->
4
4
  [Rollbar](https://rollbar.com) is an error tracking service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
@@ -12,7 +12,7 @@ This is the Ruby library for Rollbar. It will instrument many kinds of Ruby appl
12
12
  Add this line to your application's Gemfile:
13
13
 
14
14
  ```ruby
15
- gem 'rollbar', '~> 2.1.1
15
+ gem 'rollbar', '~> 2.1.2'
16
16
  ```
17
17
 
18
18
  And then execute:
@@ -1,7 +1,10 @@
1
1
  require 'rack'
2
+ require 'tempfile'
2
3
 
3
4
  module Rollbar
4
5
  module RequestDataExtractor
6
+ SKIPPED_CLASSES = [Tempfile]
7
+
5
8
  def extract_person_data_from_controller(env)
6
9
  if env.has_key? 'rollbar.person_data'
7
10
  person_data = env['rollbar.person_data'] || {}
@@ -165,22 +168,34 @@ module Rollbar
165
168
  result[key] = rollbar_filtered_params(sensitive_params, value)
166
169
  elsif value.is_a?(Array)
167
170
  result[key] = value.map do |v|
168
- v.is_a?(Hash) ? rollbar_filtered_params(sensitive_params, v) : v
171
+ v.is_a?(Hash) ? rollbar_filtered_params(sensitive_params, v) : rollbar_filtered_param_value(v)
169
172
  end
170
- elsif ATTACHMENT_CLASSES.include?(value.class.name)
171
- result[key] = {
172
- :content_type => value.content_type,
173
- :original_filename => value.original_filename,
174
- :size => value.tempfile.size
175
- } rescue 'Uploaded file'
173
+ elsif skip_value?(value)
174
+ result[key] = "Skipped value of class '#{value.class.name}'"
176
175
  else
177
- result[key] = value
176
+ result[key] = rollbar_filtered_param_value(value)
178
177
  end
179
178
 
180
179
  result
181
180
  end
182
181
  end
183
182
 
183
+ def rollbar_filtered_param_value(value)
184
+ if ATTACHMENT_CLASSES.include?(value.class.name)
185
+ begin
186
+ {
187
+ :content_type => value.content_type,
188
+ :original_filename => value.original_filename,
189
+ :size => value.tempfile.size
190
+ }
191
+ rescue
192
+ 'Uploaded file'
193
+ end
194
+ else
195
+ value
196
+ end
197
+ end
198
+
184
199
  def sensitive_params_list(env)
185
200
  Array(Rollbar.configuration.scrub_fields) | Array(env['action_dispatch.parameter_filter'])
186
201
  end
@@ -193,5 +208,8 @@ module Rollbar
193
208
  '*' * (value.length rescue 8)
194
209
  end
195
210
 
211
+ def skip_value?(value)
212
+ SKIPPED_CLASSES.any? { |klass| value.is_a?(klass) }
213
+ end
196
214
  end
197
215
  end
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
@@ -349,6 +349,36 @@ describe HomeController do
349
349
  end
350
350
  end
351
351
 
352
+ context 'with file uploads',:type => "request" do
353
+ let(:file1) { fixture_file_upload('spec/fixtures/file1') }
354
+ let(:file2) { fixture_file_upload('spec/fixtures/file2') }
355
+
356
+ context 'with a single upload' do
357
+ it "saves attachment data" do
358
+ expect { post '/file_upload', :upload => file1 }.to raise_exception
359
+
360
+ upload_param = Rollbar.last_report[:request][:params]['upload']
361
+
362
+ expect(upload_param).to have_key(:filename)
363
+ expect(upload_param).to have_key(:type)
364
+ expect(upload_param).to have_key(:name)
365
+ expect(upload_param).to have_key(:head)
366
+
367
+ expect(upload_param[:tempfile]).to be_eql("Skipped value of class 'Tempfile'")
368
+ end
369
+ end
370
+
371
+ context 'with multiple uploads' do
372
+ it "saves attachment data for all uploads" do
373
+ expect { post '/file_upload', :upload => [file1, file2] }.to raise_exception
374
+ sent_params = Rollbar.last_report[:request][:params]['upload']
375
+
376
+ expect(sent_params).to be_kind_of(Array)
377
+ expect(sent_params).to have(2).items
378
+ end
379
+ end
380
+ end
381
+
352
382
  after(:each) do
353
383
  Rollbar.configure do |config|
354
384
  config.logger = ::Rails.logger
@@ -24,11 +24,14 @@ class HomeController < ApplicationController
24
24
  render :json => {}
25
25
  end
26
26
 
27
-
28
27
  def cause_exception
29
28
  foo = bar
30
29
  end
31
30
 
31
+ def file_upload
32
+ this = will_crash
33
+ end
34
+
32
35
  def current_user
33
36
  @current_user ||= User.find_by_id(cookies[:session_id])
34
37
  end
@@ -8,4 +8,5 @@ Dummy::Application.routes.draw do
8
8
  put "/deprecated_report_exception" => "home#deprecated_report_exception"
9
9
  match "/report_exception" => "home#report_exception", :via => [:get, :post, :put]
10
10
  get "/current_user" => "home#current_user"
11
+ post "/file_upload" => "home#file_upload"
11
12
  end
@@ -0,0 +1 @@
1
+ This is a file
@@ -0,0 +1 @@
1
+ This is a file
metadata CHANGED
@@ -1,183 +1,183 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollbar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
- version_requirements: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '>='
18
- - !ruby/object:Gem::Version
19
- version: 3.0.0
20
15
  requirement: !ruby/object:Gem::Requirement
21
16
  requirements:
22
- - - '>='
17
+ - - ">="
23
18
  - !ruby/object:Gem::Version
24
19
  version: 3.0.0
25
- prerelease: false
26
20
  type: :development
27
- - !ruby/object:Gem::Dependency
28
- name: rspec-rails
21
+ prerelease: false
29
22
  version_requirements: !ruby/object:Gem::Requirement
30
23
  requirements:
31
- - - '>='
24
+ - - ">="
32
25
  - !ruby/object:Gem::Version
33
- version: 2.14.0
26
+ version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec-rails
34
29
  requirement: !ruby/object:Gem::Requirement
35
30
  requirements:
36
- - - '>='
31
+ - - ">="
37
32
  - !ruby/object:Gem::Version
38
33
  version: 2.14.0
39
- prerelease: false
40
34
  type: :development
41
- - !ruby/object:Gem::Dependency
42
- name: database_cleaner
35
+ prerelease: false
43
36
  version_requirements: !ruby/object:Gem::Requirement
44
37
  requirements:
45
- - - ~>
38
+ - - ">="
46
39
  - !ruby/object:Gem::Version
47
- version: 1.0.0
40
+ version: 2.14.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: database_cleaner
48
43
  requirement: !ruby/object:Gem::Requirement
49
44
  requirements:
50
- - - ~>
45
+ - - "~>"
51
46
  - !ruby/object:Gem::Version
52
47
  version: 1.0.0
53
- prerelease: false
54
48
  type: :development
55
- - !ruby/object:Gem::Dependency
56
- name: girl_friday
49
+ prerelease: false
57
50
  version_requirements: !ruby/object:Gem::Requirement
58
51
  requirements:
59
- - - '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: 0.11.1
54
+ version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: girl_friday
62
57
  requirement: !ruby/object:Gem::Requirement
63
58
  requirements:
64
- - - '>='
59
+ - - ">="
65
60
  - !ruby/object:Gem::Version
66
61
  version: 0.11.1
67
- prerelease: false
68
62
  type: :development
69
- - !ruby/object:Gem::Dependency
70
- name: sucker_punch
63
+ prerelease: false
71
64
  version_requirements: !ruby/object:Gem::Requirement
72
65
  requirements:
73
- - - '>='
66
+ - - ">="
74
67
  - !ruby/object:Gem::Version
75
- version: 1.0.0
68
+ version: 0.11.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: sucker_punch
76
71
  requirement: !ruby/object:Gem::Requirement
77
72
  requirements:
78
- - - '>='
73
+ - - ">="
79
74
  - !ruby/object:Gem::Version
80
75
  version: 1.0.0
81
- prerelease: false
82
76
  type: :development
83
- - !ruby/object:Gem::Dependency
84
- name: sidekiq
77
+ prerelease: false
85
78
  version_requirements: !ruby/object:Gem::Requirement
86
79
  requirements:
87
- - - '>='
80
+ - - ">="
88
81
  - !ruby/object:Gem::Version
89
- version: 2.13.0
82
+ version: 1.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: sidekiq
90
85
  requirement: !ruby/object:Gem::Requirement
91
86
  requirements:
92
- - - '>='
87
+ - - ">="
93
88
  - !ruby/object:Gem::Version
94
89
  version: 2.13.0
95
- prerelease: false
96
90
  type: :development
97
- - !ruby/object:Gem::Dependency
98
- name: genspec
91
+ prerelease: false
99
92
  version_requirements: !ruby/object:Gem::Requirement
100
93
  requirements:
101
- - - '>='
94
+ - - ">="
102
95
  - !ruby/object:Gem::Version
103
- version: 0.2.8
96
+ version: 2.13.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: genspec
104
99
  requirement: !ruby/object:Gem::Requirement
105
100
  requirements:
106
- - - '>='
101
+ - - ">="
107
102
  - !ruby/object:Gem::Version
108
103
  version: 0.2.8
109
- prerelease: false
110
104
  type: :development
111
- - !ruby/object:Gem::Dependency
112
- name: sinatra
105
+ prerelease: false
113
106
  version_requirements: !ruby/object:Gem::Requirement
114
107
  requirements:
115
- - - '>='
108
+ - - ">="
116
109
  - !ruby/object:Gem::Version
117
- version: '0'
110
+ version: 0.2.8
111
+ - !ruby/object:Gem::Dependency
112
+ name: sinatra
118
113
  requirement: !ruby/object:Gem::Requirement
119
114
  requirements:
120
- - - '>='
115
+ - - ">="
121
116
  - !ruby/object:Gem::Version
122
117
  version: '0'
123
- prerelease: false
124
118
  type: :development
125
- - !ruby/object:Gem::Dependency
126
- name: resque
119
+ prerelease: false
127
120
  version_requirements: !ruby/object:Gem::Requirement
128
121
  requirements:
129
- - - '>='
122
+ - - ">="
130
123
  - !ruby/object:Gem::Version
131
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: resque
132
127
  requirement: !ruby/object:Gem::Requirement
133
128
  requirements:
134
- - - '>='
129
+ - - ">="
135
130
  - !ruby/object:Gem::Version
136
131
  version: '0'
137
- prerelease: false
138
132
  type: :development
139
- - !ruby/object:Gem::Dependency
140
- name: delayed_job
133
+ prerelease: false
141
134
  version_requirements: !ruby/object:Gem::Requirement
142
135
  requirements:
143
- - - '>='
136
+ - - ">="
144
137
  - !ruby/object:Gem::Version
145
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: delayed_job
146
141
  requirement: !ruby/object:Gem::Requirement
147
142
  requirements:
148
- - - '>='
143
+ - - ">="
149
144
  - !ruby/object:Gem::Version
150
145
  version: '0'
151
- prerelease: false
152
146
  type: :development
153
- - !ruby/object:Gem::Dependency
154
- name: rake
147
+ prerelease: false
155
148
  version_requirements: !ruby/object:Gem::Requirement
156
149
  requirements:
157
- - - '>='
150
+ - - ">="
158
151
  - !ruby/object:Gem::Version
159
- version: 0.9.0
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rake
160
155
  requirement: !ruby/object:Gem::Requirement
161
156
  requirements:
162
- - - '>='
157
+ - - ">="
163
158
  - !ruby/object:Gem::Version
164
159
  version: 0.9.0
165
- prerelease: false
166
160
  type: :development
167
- - !ruby/object:Gem::Dependency
168
- name: redis
161
+ prerelease: false
169
162
  version_requirements: !ruby/object:Gem::Requirement
170
163
  requirements:
171
- - - '>='
164
+ - - ">="
172
165
  - !ruby/object:Gem::Version
173
- version: '0'
166
+ version: 0.9.0
167
+ - !ruby/object:Gem::Dependency
168
+ name: redis
174
169
  requirement: !ruby/object:Gem::Requirement
175
170
  requirements:
176
- - - '>='
171
+ - - ">="
177
172
  - !ruby/object:Gem::Version
178
173
  version: '0'
179
- prerelease: false
180
174
  type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
181
  description: Rails plugin to catch and send exceptions to Rollbar
182
182
  email:
183
183
  - support@rollbar.com
@@ -186,8 +186,8 @@ executables:
186
186
  extensions: []
187
187
  extra_rdoc_files: []
188
188
  files:
189
- - .gitignore
190
- - .travis.yml
189
+ - ".gitignore"
190
+ - ".travis.yml"
191
191
  - Appraisals
192
192
  - CHANGELOG.md
193
193
  - Gemfile
@@ -306,6 +306,8 @@ files:
306
306
  - spec/dummyapp/public/500.html
307
307
  - spec/dummyapp/public/favicon.ico
308
308
  - spec/dummyapp/script/rails
309
+ - spec/fixtures/file1
310
+ - spec/fixtures/file2
309
311
  - spec/fixtures/payloads/message.json
310
312
  - spec/fixtures/payloads/sample.trace.json
311
313
  - spec/fixtures/payloads/sample.trace_chain.json
@@ -342,24 +344,24 @@ homepage: https://rollbar.com
342
344
  licenses:
343
345
  - MIT
344
346
  metadata: {}
345
- post_install_message:
347
+ post_install_message:
346
348
  rdoc_options: []
347
349
  require_paths:
348
350
  - lib
349
351
  required_ruby_version: !ruby/object:Gem::Requirement
350
352
  requirements:
351
- - - '>='
353
+ - - ">="
352
354
  - !ruby/object:Gem::Version
353
355
  version: '0'
354
356
  required_rubygems_version: !ruby/object:Gem::Requirement
355
357
  requirements:
356
- - - '>='
358
+ - - ">="
357
359
  - !ruby/object:Gem::Version
358
360
  version: '0'
359
361
  requirements: []
360
- rubyforge_project:
361
- rubygems_version: 2.4.5
362
- signing_key:
362
+ rubyforge_project:
363
+ rubygems_version: 2.4.1
364
+ signing_key:
363
365
  specification_version: 4
364
366
  summary: Reports exceptions to Rollbar
365
367
  test_files:
@@ -416,6 +418,8 @@ test_files:
416
418
  - spec/dummyapp/public/500.html
417
419
  - spec/dummyapp/public/favicon.ico
418
420
  - spec/dummyapp/script/rails
421
+ - spec/fixtures/file1
422
+ - spec/fixtures/file2
419
423
  - spec/fixtures/payloads/message.json
420
424
  - spec/fixtures/payloads/sample.trace.json
421
425
  - spec/fixtures/payloads/sample.trace_chain.json