From 9b3593bc0213162fa9204d65f6bd6275337424b2 Mon Sep 17 00:00:00 2001 From: Adam Wisher <37659188+mrwish7@users.noreply.github.com> Date: Tue, 22 Jul 2025 17:51:07 +0100 Subject: [PATCH] Valid PS compare fix for PS under 3 chars Fix to allow stations with a PS less than 3 characters to be IDed when PS validity checked --- server/tx_search.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/tx_search.js b/server/tx_search.js index fce7019..d4c9b59 100644 --- a/server/tx_search.js +++ b/server/tx_search.js @@ -197,6 +197,9 @@ function validPsCompare(rdsPs, stationPs) { // Iterate through all tokens and check if any token yields at least three valid (non "_" ) matches. for (let token of psTokens) { + // If total non "_" length of token is less than 3, allow match based on that length instead + const tokenLength = token.replace(/_/g, "").length; + const minMatchLen = tokenLength > 2 ? 3 : tokenLength; // If the token's length does not match the standardized rdsPs length, skip this token. if (token.length !== standardizedRdsPs.length) continue; @@ -208,7 +211,7 @@ function validPsCompare(rdsPs, stationPs) { matchCount++; } } - if (matchCount >= 3) { + if (matchCount >= minMatchLen) { return true; } } @@ -393,4 +396,4 @@ function deg2rad(deg) { module.exports = { fetchTx -}; \ No newline at end of file +};