Reject malformed channel QR links and document channel QR scanning

A name with invalid percent-encoding (e.g. name=%FF) made
Uri.queryParameters throw from the scanner's validator. The parser now
returns null for it, with a regression test.

Update the channels and additional-features guides for the renamed
"Scan a QR Code" option, the supported channel link format, and its
limits.
This commit is contained in:
zjs81 committed 2026-10-24 22:30:51 -07:00
1 parent b1e968e7bf
commit f58a76904a
4 files changed
+27 -8

No files matched your search

+8 -1
View File
@@ -28,7 +28,14 @@ ScannedChannel? parseChannelQr(String data) {
);
if (normalizedPath != 'channel/add') return null;
final params = uri.queryParameters;
// Decoding throws on malformed percent-encoding (e.g. `name=%FF`); the
// scanner calls this from its validator, so treat that as not a channel QR.
final Map<String, String> params;
try {
params = uri.queryParameters;
} on FormatException {
return null;
}
final name = (params['name'] ?? '').trim();
if (name.isEmpty) return null;