fix: two regressions this rebuild introduced for non-APRS users
Both found by an auditor comparing behaviour against the released build rather than
against the intent of the change.
Prefix-first portable callsigns were rejected. CallsignEntry took the first segment -
`call.substringBefore('/')` - and required a letter and a digit in it. A portable call can
be written prefix-first, DL/W1AW or ZL/JA1ABC or OH/W1AW/MM, where the leading token is a
country prefix with no digit at all. Measured: five such forms were refused where the old
length-only check had accepted them. Any segment may now carry the callsign.
JSON cookie exports stopped working for QRZ. QrzGridParser.cookieHeader converts the JSON
array a browser extension produces into a Cookie header, and it had zero production
callers - the raw pasted text went straight into the header. The old client normalised it.
So an operator whose export had been working would see their cookie sent as a literal JSON
blob, QRZ would serve its signed-out page, and the app would tell them the cookie had
expired when it was perfectly good. A raw `k=v; k=v` paste was unaffected, which is why
this survived review.
Both are cases where a rewrite lost behaviour the old code had. Neither had a test.
This commit is contained in:
1 parent
3a8086eb05
commit
fe6d0af8b7
3 files changed
+39
-3
No files matched your search
@@ -66,7 +66,19 @@ class QrzGridSource(
|
||||
}
|
||||
|
||||
/** Fetch [url], retrying transport failures with backoff. Null when every attempt failed. */
|
||||
private suspend fun fetchWithRetry(url: String, cookieHeader: String): String? {
|
||||
/**
|
||||
* Normalise whatever the operator pasted into a Cookie header value.
|
||||
*
|
||||
* They paste either a raw `k=v; k=v` header or the JSON array a cookie-export extension
|
||||
* produces. The old client normalised this and the rewrite dropped it, so a JSON export that
|
||||
* used to work went out as a literal JSON blob, QRZ served its signed-out page, and the app
|
||||
* told the operator their cookie had expired when it was perfectly good.
|
||||
*/
|
||||
private fun normalise(raw: String): String = QrzGridParser.cookieHeader(raw)
|
||||
|
||||
private suspend fun fetchWithRetry(url: String, rawCookie: String): String? {
|
||||
val cookieHeader = normalise(rawCookie)
|
||||
if (cookieHeader.isBlank()) return null
|
||||
repeat(MAX_ATTEMPTS) { attempt ->
|
||||
try {
|
||||
val request = Request.Builder().url(url)
|
||||
|
||||
Reference in new issue
Block a user