Skip to content

Commit c052209

Browse files
authored
Release v6.26.2
2 parents 3084374 + 32d8e4c commit c052209

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changelog
22
=========
33

4+
## v6.26.2 (17 January 2024)
5+
6+
### Fixes
7+
8+
* Fix unhandled `URI::InvalidURIError` in `Cleaner#clean_url`
9+
| [#811](https://github.com/bugsnag/bugsnag-ruby/pull/811)
10+
411
## v6.26.1 (9 January 2024)
512

613
### Fixes

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.26.1
1+
6.26.2

lib/bugsnag/cleaner.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,16 @@ def clean_object(object)
2626
# @return [String]
2727
def clean_url(url)
2828
return url if @configuration.meta_data_filters.empty? && @configuration.redacted_keys.empty?
29+
return url unless url.include?('?')
30+
31+
begin
32+
uri = URI(url)
33+
rescue URI::InvalidURIError
34+
pre_query_string, _query_string = url.split('?', 2)
35+
36+
return "#{pre_query_string}?#{FILTERED}"
37+
end
2938

30-
uri = URI(url)
3139
return url unless uri.query
3240

3341
query_params = uri.query.split('&').map { |pair| pair.split('=') }

spec/cleaner_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,5 +540,17 @@ def to_s
540540
let(:url) { "https://host.example/sessions?access_token=abc123" }
541541
it { should eq "https://host.example/sessions?access_token=[FILTERED]" }
542542
end
543+
544+
context "with an invalid URL" do
545+
let(:filters) { [/token/] }
546+
let(:url) { "https://host.example/a b c d e f g?access_token=abc123&password=secret&token2=xyz987" }
547+
it { should eq "https://host.example/a b c d e f g?[FILTERED]" }
548+
end
549+
550+
context "with an invalid URL and no query string" do
551+
let(:filters) { [/token/] }
552+
let(:url) { "https://host.example/a b c d e f g" }
553+
it { should eq "https://host.example/a b c d e f g" }
554+
end
543555
end
544556
end

0 commit comments

Comments
 (0)