Skip to content

Reject HTML error pages when downloading the country file - #1141

Merged
ea4k merged 1 commit into
ea4k:masterfrom
yl3gbc:cty-download-validate
Oct 16, 2026
Merged

ea4k merged 1 commit into
ea4k:masterfrom
yl3gbc:cty-download-validate

Conversation

@yl3gbc

@yl3gbc yl3gbc commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

saveToDisk() writes whatever the server returned, without checking that it is a country file. When the download fails in a way that still gives an HTTP 200 - a captcha page, a redirect to an error page, a proxy notice - that HTML replaces cty.csv, and every DXCC lookup silently stops working. KLog reports the download as successful.

I hit this on a live log: cty.csv was 12 kB of HTML instead of ~290 kB of data, and getQRZARRLId() returned -3 for every callsign. There is no error anywhere, so the only symptom is that entities stop being recognised.

This checks the payload before replacing the existing file: an HTML document or a suspiciously small file is rejected and the old data kept.

saveToDisk() writes whatever the server returned, without checking that
it is a country file. When the download fails in a way that still gives
an HTTP 200 - a captcha page, a redirect to an error page, a proxy
notice - that HTML replaces cty.csv, and every DXCC lookup silently
stops working. KLog reports the download as successful.

I hit this on a live log: cty.csv was 12 kB of HTML instead of ~290 kB
of data, and getQRZARRLId() returned -3 for every callsign. There is no
error anywhere, so the only symptom is that entities stop being
recognised.

This checks the payload before replacing the existing file: an HTML
document or a suspiciously small file is rejected and the old data kept.
@sonarqubecloud

Copy link
Copy Markdown

@ea4k
ea4k merged commit 6c9f2d6 into ea4k:master Oct 16, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants