From 0748466811b86df8b4473a898fda8f646379f1b6 Mon Sep 17 00:00:00 2001 From: Glenn Thompson Date: Wed, 10 Dec 2025 20:28:18 +0300 Subject: [PATCH] Fix GeoIP lookup: convert drakma byte response to string Drakma returns a byte vector, not a string. The code was passing this directly to cl-json:decode-json-from-string which expects a string, causing the lookup to silently fail. --- listener-stats.lisp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/listener-stats.lisp b/listener-stats.lisp index aab1a5f..0997117 100644 --- a/listener-stats.lisp +++ b/listener-stats.lisp @@ -66,7 +66,10 @@ (handler-case (let* ((url (format nil *geoip-api-url* ip-address)) (response (drakma:http-request url :want-stream nil)) - (data (cl-json:decode-json-from-string response))) + (response-string (if (stringp response) + response + (babel:octets-to-string response :encoding :utf-8))) + (data (cl-json:decode-json-from-string response-string))) (when (string= (cdr (assoc :status data)) "success") (list :country-code (cdr (assoc :country-code data)) :city (cdr (assoc :city data))