File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -248,16 +248,15 @@ func (s *Session) SaveSessionDeviceInformation(r *http.Request) {
248
248
device .IPAddress = & r .RemoteAddr
249
249
}
250
250
251
- clientGeoLocation := []string { r . Header . Get ( "Cf-Ipcity" ), r . Header . Get ( "Cf-Ipcountry" )}
251
+ var clientGeoLocation []string
252
252
253
- var sb strings.Builder
254
- for _ , i := range clientGeoLocation {
255
- if sb .Len () != 0 && i != "" {
256
- sb .WriteString (", " )
257
- }
258
- sb .WriteString (i )
253
+ if r .Header .Get ("Cf-Ipcity" ) != "" {
254
+ clientGeoLocation = append (clientGeoLocation , r .Header .Get ("Cf-Ipcity" ))
255
+ }
256
+ if r .Header .Get ("Cf-Ipcountry" ) != "" {
257
+ clientGeoLocation = append (clientGeoLocation , r .Header .Get ("Cf-Ipcountry" ))
259
258
}
260
- device .Location = stringsx .GetPointer (sb . String ( ))
259
+ device .Location = stringsx .GetPointer (strings . Join ( clientGeoLocation , ", " ))
261
260
262
261
s .Devices = append (s .Devices , device )
263
262
}
You can’t perform that action at this time.
0 commit comments