|
@@ -83,21 +83,21 @@ class Code {
|
|
static Code fromRawData(String rawData) {
|
|
static Code fromRawData(String rawData) {
|
|
Uri uri = Uri.parse(rawData);
|
|
Uri uri = Uri.parse(rawData);
|
|
try {
|
|
try {
|
|
- return Code(
|
|
|
|
- _getAccount(uri),
|
|
|
|
- _getIssuer(uri),
|
|
|
|
- _getDigits(uri),
|
|
|
|
- _getPeriod(uri),
|
|
|
|
- getSanitizedSecret(uri.queryParameters['secret']!),
|
|
|
|
- _getAlgorithm(uri),
|
|
|
|
- _getType(uri),
|
|
|
|
- _getCounter(uri),
|
|
|
|
- rawData,
|
|
|
|
- );
|
|
|
|
- } catch(e) {
|
|
|
|
|
|
+ return Code(
|
|
|
|
+ _getAccount(uri),
|
|
|
|
+ _getIssuer(uri),
|
|
|
|
+ _getDigits(uri),
|
|
|
|
+ _getPeriod(uri),
|
|
|
|
+ getSanitizedSecret(uri.queryParameters['secret']!),
|
|
|
|
+ _getAlgorithm(uri),
|
|
|
|
+ _getType(uri),
|
|
|
|
+ _getCounter(uri),
|
|
|
|
+ rawData,
|
|
|
|
+ );
|
|
|
|
+ } catch (e) {
|
|
// if account name contains # without encoding,
|
|
// if account name contains # without encoding,
|
|
// rest of the url are treated as url fragment
|
|
// rest of the url are treated as url fragment
|
|
- if(rawData.contains("#")) {
|
|
|
|
|
|
+ if (rawData.contains("#")) {
|
|
return Code.fromRawData(rawData.replaceAll("#", '%23'));
|
|
return Code.fromRawData(rawData.replaceAll("#", '%23'));
|
|
} else {
|
|
} else {
|
|
rethrow;
|
|
rethrow;
|
|
@@ -127,7 +127,7 @@ class Code {
|
|
if (uri.queryParameters.containsKey("issuer")) {
|
|
if (uri.queryParameters.containsKey("issuer")) {
|
|
String issuerName = uri.queryParameters['issuer']!;
|
|
String issuerName = uri.queryParameters['issuer']!;
|
|
// Handle issuer name with period
|
|
// Handle issuer name with period
|
|
- // See https://github.com/ente-io/auth/pull/77
|
|
|
|
|
|
+ // See https://github.com/ente-io/ente/pull/77
|
|
if (issuerName.contains("period=")) {
|
|
if (issuerName.contains("period=")) {
|
|
return issuerName.substring(0, issuerName.indexOf("period="));
|
|
return issuerName.substring(0, issuerName.indexOf("period="));
|
|
}
|
|
}
|