mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-11 05:38:03 -05:00
Fixed decoding of store URIs with empty passwords
This commit is contained in:
parent
9fa802afe2
commit
dd8cd33c5a
@ -191,8 +191,14 @@ public class ImapStore extends Store {
|
||||
|
||||
if (imapUri.getUserInfo() != null) {
|
||||
try {
|
||||
String[] userInfoParts = imapUri.getUserInfo().split(":");
|
||||
if (userInfoParts.length == 2) {
|
||||
String userinfo = imapUri.getUserInfo();
|
||||
String[] userInfoParts = userinfo.split(":");
|
||||
|
||||
if (userinfo.endsWith(":")) {
|
||||
// Password is empty. This can only happen after an account was imported.
|
||||
authenticationType = AuthType.valueOf(userInfoParts[0]).name();
|
||||
username = URLDecoder.decode(userInfoParts[1], "UTF-8");
|
||||
} else if (userInfoParts.length == 2) {
|
||||
authenticationType = AuthType.PLAIN.name();
|
||||
username = URLDecoder.decode(userInfoParts[0], "UTF-8");
|
||||
password = URLDecoder.decode(userInfoParts[1], "UTF-8");
|
||||
|
@ -115,8 +115,11 @@ public class Pop3Store extends Store {
|
||||
if (pop3Uri.getUserInfo() != null) {
|
||||
try {
|
||||
int userIndex = 0, passwordIndex = 1;
|
||||
String[] userInfoParts = pop3Uri.getUserInfo().split(":");
|
||||
if (userInfoParts.length > 2) {
|
||||
String userinfo = pop3Uri.getUserInfo();
|
||||
String[] userInfoParts = userinfo.split(":");
|
||||
if (userInfoParts.length > 2 || userinfo.endsWith(":") ) {
|
||||
// If 'userinfo' ends with ":" the password is empty. This can only happen
|
||||
// after an account was imported (so authType and username are present).
|
||||
userIndex++;
|
||||
passwordIndex++;
|
||||
authType = userInfoParts[0];
|
||||
|
Loading…
Reference in New Issue
Block a user