Skip to content

Commit c752698

Browse files
committed
prevent overwriting server_name
1 parent 838a629 commit c752698

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/sentry/event.ex

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,12 @@ defmodule Sentry.Event do
157157
end
158158

159159
@spec add_metadata(Event.t) :: Event.t
160-
def add_metadata(state) do
160+
def add_metadata(%Event{} = state) do
161161
%{state |
162-
event_id: UUID.uuid4(:hex),
163-
timestamp: Util.iso8601_timestamp(),
164-
server_name: to_string(:net_adm.localhost)}
162+
event_id: UUID.uuid4(:hex),
163+
timestamp: Util.iso8601_timestamp(),
164+
}
165+
|> Map.update(:server_name, nil, fn(server_name) -> server_name || to_string(:net_adm.localhost) end)
165166
end
166167

167168
@spec stacktrace_to_frames(Exception.stacktrace) :: [map]

0 commit comments

Comments
 (0)