Refactoring

This commit is contained in:
M66B 2023-12-24 16:34:58 +01:00
parent faf1993482
commit 798fd32c19
1 changed files with 11 additions and 12 deletions

View File

@ -336,18 +336,6 @@ public class UriHelper {
Uri result = (s > 0 ? Uri.parse(path.substring(s + 1)) : null);
changed = (result != null && isHyperLink(result));
url = (changed ? result : uri);
} else if (uri.getQueryParameter("redirectUrl") != null) {
// https://.../link-tracker?redirectUrl=<base64>&sig=...&iat=...&a=...&account=...&email=...&s=...&i=...
Uri result = null;
try {
byte[] bytes = Base64.decode(uri.getQueryParameter("redirectUrl"), Base64.URL_SAFE);
String u = URLDecoder.decode(new String(bytes), StandardCharsets.UTF_8.name());
result = Uri.parse(u);
} catch (Throwable ex) {
Log.i(ex);
}
changed = (result != null && isHyperLink(result));
url = (changed ? result : uri);
} else {
Uri result = null;
@ -408,6 +396,17 @@ public class UriHelper {
Log.e(ex);
}
if (result == null &&
uri.getQueryParameter("redirectUrl") != null)
// https://.../link-tracker?redirectUrl=<base64>&sig=...&iat=...&a=...&account=...&email=...&s=...&i=...
try {
byte[] bytes = Base64.decode(uri.getQueryParameter("redirectUrl"), Base64.URL_SAFE);
String u = URLDecoder.decode(new String(bytes), StandardCharsets.UTF_8.name());
result = Uri.parse(u);
} catch (Throwable ex) {
Log.i(ex);
}
changed = (result != null && isHyperLink(result));
url = (changed ? result : uri);
}