File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1
1
## Unreleased
2
2
3
+ ### Bug Fixes
4
+
5
+ - Don't overwrite ` ip_address ` if already set on ` user ` [ #2350 ] ( https://github.com/getsentry/sentry-ruby/pull/2350 )
6
+ - Fixes [ #2347 ] ( https://github.com/getsentry/sentry-ruby/issues/2347 )
7
+
3
8
### Internal
4
9
5
10
- Use Concurrent.usable_processor_count when it is available ([ #2339 ] ( https://github.com/getsentry/sentry-ruby/pull/2339 ) )
Original file line number Diff line number Diff line change @@ -104,9 +104,7 @@ def rack_env=(env)
104
104
unless request || env . empty?
105
105
add_request_interface ( env )
106
106
107
- if @send_default_pii
108
- user [ :ip_address ] = calculate_real_ip_from_rack ( env )
109
- end
107
+ user [ :ip_address ] ||= calculate_real_ip_from_rack ( env ) if @send_default_pii
110
108
111
109
if request_id = Utils ::RequestId . read_from ( env )
112
110
tags [ :request_id ] = request_id
Original file line number Diff line number Diff line change 141
141
expect ( event . to_hash [ :user ] [ :ip_address ] ) . to eq ( "2.2.2.2" )
142
142
end
143
143
144
+ it "doesn't overwrite already set ip address" do
145
+ Sentry . set_user ( { ip_address : "3.3.3.3" } )
146
+ Sentry . get_current_scope . apply_to_event ( event )
147
+ expect ( event . to_hash [ :user ] [ :ip_address ] ) . to eq ( "3.3.3.3" )
148
+ end
149
+
144
150
context "with config.trusted_proxies = [\" 2.2.2.2\" ]" do
145
151
before do
146
152
Sentry . configuration . trusted_proxies = [ "2.2.2.2" ]
You can’t perform that action at this time.
0 commit comments