From 62b5fc3e4088237e9e81480a2daa5ae0f6d6d0f1 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Wed, 24 Sep 2025 08:43:58 -0400 Subject: [PATCH] fix QSO panel when using a date format with commas Commas are not an allowed URI character, and so they need to be replaced with a URI-safe stand in before being used. Of the default URI-safe characters, only '~%:\' are not used yet. I chose to use '%' as it seems the least likely to be used in any future date formats. Closes #2343. --- application/controllers/Logbook.php | 6 +++++- assets/js/sections/qso.js | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/application/controllers/Logbook.php b/application/controllers/Logbook.php index 62700cc67..ce2ae382b 100644 --- a/application/controllers/Logbook.php +++ b/application/controllers/Logbook.php @@ -77,10 +77,14 @@ class Logbook extends CI_Controller { // Normalize the date only if it's not empty if (!empty($date)) { + // Characters '/' and ',' are not URL safe, so we replace + // them with '_' and '%'. Switch them back here. if (strpos($date, '_') !== false) { - // Replace slashes with dashes for URL processing $date = str_replace('_', '/', $date); } + if (strpos($date, '%') !== false) { + $date = str_replace('%', ',', $date); + } // Get user-preferred date format if ($this->session->userdata('user_date_format')) { $date_format = $this->session->userdata('user_date_format'); diff --git a/assets/js/sections/qso.js b/assets/js/sections/qso.js index f889b23b8..4f6c44797 100644 --- a/assets/js/sections/qso.js +++ b/assets/js/sections/qso.js @@ -940,9 +940,14 @@ $("#callsign").on("focusout", function () { let find_callsign = $(this).val().toUpperCase(); let callsign = find_callsign; let startDate = $('#start_date').val(); + // Characters '/' and ',' are not URL safe, so we replace + // them with '_' and '%'. if (startDate.includes('/')) { startDate = startDate.replaceAll('/', '_'); } + if (startDate.includes(',')) { + startDate = startDate.replaceAll(',', '%'); + } startDate = encodeURIComponent(startDate); const stationProfile = $('#stationProfile').val();