airbrake-ruby 1.2.2 → 1.2.3

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: ca403eaf9b4aeb5fb5ca045087642ad1401e738c
4
- data.tar.gz: 34696a178cd229b8af3c2c9a5f99bef94e2b72d5
3
+ metadata.gz: 7584737ab96d10454a892c2a5962f71efa1f344b
4
+ data.tar.gz: 0b0b806ab0434e86f0ad797854679e53480997d7
5
5
  SHA512:
6
- metadata.gz: 2e52ed3bda29d983c09d8998a084f5c3a1c937f37872e624bc4769936552bad215394ced32cbf6d04ff5083c882db3fd5b5b6dc5c7601ecae29f4371830dc4fd
7
- data.tar.gz: 90dc365fc8000e40192a959aeea5bec8693451c75e79925640b62186d78bebd92467887983f5b6ca70ba05b4e465222552ba36e788c4e6fc0623ee9e12ab3bf0
6
+ metadata.gz: 5a1891009204e5d5dbca417495d270eabab1340a7059f106430a1c50c5de0f41647f864defd0ce9642fa06d9b4e0425aa81c908925c024e860f45148e7773832
7
+ data.tar.gz: 39bae0e2ac392cb11ea1d55b3a8ae2dd7d513fba0dcd6e7908af4bcc8c962360d7a76a8ce9fe4c3d2d9c1dc5de87c69cf34bbdd4d541a943df96b1a7719de0a4
@@ -37,10 +37,7 @@ module Airbrake
37
37
  end
38
38
 
39
39
  return unless notice[:context][:url]
40
- url = URI(notice[:context][:url])
41
- return if url.nil? || url.query.nil?
42
-
43
- notice[:context][:url] = filter_url_params(url)
40
+ filter_url(notice)
44
41
  end
45
42
 
46
43
  ##
@@ -74,6 +71,17 @@ module Airbrake
74
71
 
75
72
  url.to_s
76
73
  end
74
+
75
+ def filter_url(notice)
76
+ begin
77
+ url = URI(notice[:context][:url])
78
+ rescue URI::InvalidURIError
79
+ return
80
+ end
81
+
82
+ return unless url.query
83
+ notice[:context][:url] = filter_url_params(url)
84
+ end
77
85
  end
78
86
  end
79
87
  end
@@ -3,5 +3,5 @@
3
3
  module Airbrake
4
4
  ##
5
5
  # @return [String] the library version
6
- AIRBRAKE_RUBY_VERSION = '1.2.2'.freeze
6
+ AIRBRAKE_RUBY_VERSION = '1.2.3'.freeze
7
7
  end
@@ -685,6 +685,44 @@ RSpec.describe Airbrake::Notifier do
685
685
  with(body: expected_body)
686
686
  ).to have_been_made.once
687
687
  end
688
+
689
+ context "given a non-standard URL" do
690
+ it "leaves the URL unfiltered" do
691
+ @airbrake.whitelist_keys(%w(bish))
692
+
693
+ notice = @airbrake.build_notice(ex)
694
+ notice[:context][:url] =
695
+ 'http://localhost:3000/cra]]]sh?foo=bar&baz=bongo&bish=bash'
696
+
697
+ @airbrake.notify_sync(notice)
698
+
699
+ # rubocop:disable Metrics/LineLength
700
+ expected_body =
701
+ %r("context":{.*"url":"http://localhost:3000/cra\]\]\]sh\?foo=bar&baz=bongo&bish=bash".*})
702
+ # rubocop:enable Metrics/LineLength
703
+
704
+ expect(
705
+ a_request(:post, endpoint).
706
+ with(body: expected_body)
707
+ ).to have_been_made.once
708
+ end
709
+ end
710
+
711
+ context "given a URL without a query" do
712
+ it "skips params filtering and leaves the URL untouched" do
713
+ @airbrake.whitelist_keys(%w(bish))
714
+
715
+ notice = @airbrake.build_notice(ex)
716
+ notice[:context][:url] = 'http://localhost:3000/crash'
717
+
718
+ @airbrake.notify_sync(notice)
719
+
720
+ expect(
721
+ a_request(:post, endpoint).
722
+ with(body: %r("context":{.*"url":"http://localhost:3000/crash".*}))
723
+ ).to have_been_made.once
724
+ end
725
+ end
688
726
  end
689
727
  end
690
728
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-05 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec