Fix WiFi (ZX or DPP) QR code parsing to ignore leading spaces
Increase robustness of QR code parsing: while leading spaces aren't expected (or allowed) they are observed in the wild and can be safely ignored. Bug: 292331368 Test: validated that QR code with scan is now parsed correctly Test: atest WifiQrCodeTest Change-Id: Ifff79870bea2ec9924f7b2e8100c2c01fd350846
This commit is contained in:
@@ -160,8 +160,9 @@ public class WifiQrCode {
|
||||
|
||||
private String getValueOrNull(List<String> keyValueList, String prefix) {
|
||||
for (String keyValue : keyValueList) {
|
||||
if (keyValue.startsWith(prefix)) {
|
||||
return keyValue.substring(prefix.length());
|
||||
String strippedKeyValue = keyValue.stripLeading();
|
||||
if (strippedKeyValue.startsWith(prefix)) {
|
||||
return strippedKeyValue.substring(prefix.length());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user