From 9814b656b2b61b33758d97b3d00f252c870e7416 Mon Sep 17 00:00:00 2001 From: Ian Renton Date: Thu, 2 Apr 2026 19:28:42 +0100 Subject: [PATCH] Protection against strings getting into lat/lon --- data/spot.py | 6 ++++++ templates/about.html | 2 +- templates/add_spot.html | 4 ++-- templates/alerts.html | 4 ++-- templates/bands.html | 6 +++--- templates/base.html | 8 ++++---- templates/conditions.html | 4 ++-- templates/map.html | 6 +++--- templates/spots.html | 6 +++--- templates/status.html | 4 ++-- 10 files changed, 28 insertions(+), 22 deletions(-) diff --git a/data/spot.py b/data/spot.py index 2ee054d..fd20e93 100644 --- a/data/spot.py +++ b/data/spot.py @@ -337,6 +337,12 @@ class Spot: self.dx_grid = lookup_helper.infer_grid_from_callsign_dxcc(self.dx_call) self.dx_location_source = "DXCC" + # It looks like we can sometimes get a string into lat/lon, so reject that before we try looking anything up + if type(self.dx_latitude) == "str" or type(self.dx_longitude) == "str": + logging.warning("Received strings in lat/lon (" + str(self.dx_latitude) + ", " + str(self.dx_longitude) + "), rejecting it") + self.dx_latitude = None + self.dx_longitude = None + # CQ and ITU zone lookup, preferably from location but failing that, from callsign if not self.dx_cq_zone: if self.dx_latitude: diff --git a/templates/about.html b/templates/about.html index d6bea1e..989d49c 100644 --- a/templates/about.html +++ b/templates/about.html @@ -67,7 +67,7 @@

This software is dedicated to the memory of Tom G1PJB, SK, a friend and colleague who sadly passed away around the time I started writing it in Autumn 2025. I was looking forward to showing it to you when it was done.

- + {% end %} \ No newline at end of file diff --git a/templates/add_spot.html b/templates/add_spot.html index 61fb695..d52cf5d 100644 --- a/templates/add_spot.html +++ b/templates/add_spot.html @@ -69,8 +69,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/alerts.html b/templates/alerts.html index a8b9832..42fc865 100644 --- a/templates/alerts.html +++ b/templates/alerts.html @@ -56,8 +56,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/bands.html b/templates/bands.html index a02be0d..89f8edd 100644 --- a/templates/bands.html +++ b/templates/bands.html @@ -62,9 +62,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index b098bfe..bc304f7 100644 --- a/templates/base.html +++ b/templates/base.html @@ -46,10 +46,10 @@ crossorigin="anonymous"> - - - - + + + + diff --git a/templates/conditions.html b/templates/conditions.html index 2b40843..07ed072 100644 --- a/templates/conditions.html +++ b/templates/conditions.html @@ -189,8 +189,8 @@ - - + + {% end %} \ No newline at end of file diff --git a/templates/map.html b/templates/map.html index 64935d7..a1b0665 100644 --- a/templates/map.html +++ b/templates/map.html @@ -70,9 +70,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/spots.html b/templates/spots.html index 080f4d8..4bd47fd 100644 --- a/templates/spots.html +++ b/templates/spots.html @@ -87,9 +87,9 @@ - - - + + + {% end %} \ No newline at end of file diff --git a/templates/status.html b/templates/status.html index cc018d2..33e796e 100644 --- a/templates/status.html +++ b/templates/status.html @@ -59,8 +59,8 @@ - - + +