mirror of
https://github.com/moparisthebest/k-9
synced 2024-08-13 17:03:48 -04: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) {
|
if (imapUri.getUserInfo() != null) {
|
||||||
try {
|
try {
|
||||||
String[] userInfoParts = imapUri.getUserInfo().split(":");
|
String userinfo = imapUri.getUserInfo();
|
||||||
if (userInfoParts.length == 2) {
|
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();
|
authenticationType = AuthType.PLAIN.name();
|
||||||
username = URLDecoder.decode(userInfoParts[0], "UTF-8");
|
username = URLDecoder.decode(userInfoParts[0], "UTF-8");
|
||||||
password = URLDecoder.decode(userInfoParts[1], "UTF-8");
|
password = URLDecoder.decode(userInfoParts[1], "UTF-8");
|
||||||
|
@ -115,8 +115,11 @@ public class Pop3Store extends Store {
|
|||||||
if (pop3Uri.getUserInfo() != null) {
|
if (pop3Uri.getUserInfo() != null) {
|
||||||
try {
|
try {
|
||||||
int userIndex = 0, passwordIndex = 1;
|
int userIndex = 0, passwordIndex = 1;
|
||||||
String[] userInfoParts = pop3Uri.getUserInfo().split(":");
|
String userinfo = pop3Uri.getUserInfo();
|
||||||
if (userInfoParts.length > 2) {
|
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++;
|
userIndex++;
|
||||||
passwordIndex++;
|
passwordIndex++;
|
||||||
authType = userInfoParts[0];
|
authType = userInfoParts[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user