Fix error in None handling of unknown city/country in filtered users

This commit is contained in:
Gregory Soutade 2022-11-16 21:09:36 +01:00
parent cce8c75118
commit 242bb6cabe
1 changed files with 7 additions and 2 deletions

View File

@ -85,8 +85,13 @@ class IWLADisplayFilterUsers(IPlugin):
ip_title = '%s [%s]' % (hits[ip]['remote_addr'], ip)
location = filtered_user.get('geo_location', {})
if location:
location_str = '(%s/%s)' % (location.get('city', unknown), location.get('countryname', unknown))
ip_title = f'{ip_title}<br/>{location_str}'
city = location.get('city', unknown)
country = location.get('countryname', unknown)
if not city: city = unknown
if not country: country = unknown
# At least, one information
if city != unknown or country != unknown:
ip_title = f'{ip_title}<br/>({city}/{country})'
table.appendRow([f'<b>{ip_title}</b>', '', ''])
table.setCellCSSClass(row, 0, '')
for r in hits[ip]['requests'][::-1]: