Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2acd55a9 authored by cketti's avatar cketti
Browse files

Implemented work-around to handle malformed UIDL responses (POP3).

Fixes issue 3546
parent 9f581cb6
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -456,7 +456,22 @@ public class Pop3Store extends Store {
                    if (response.equals(".")) {
                        break;
                    }
                    String[] uidParts = response.split(" ");

                    /*
                     * Yet another work-around for buggy server software:
                     * Replace every occurence of multiple spaces with exactly one space. This way
                     * the String.split() call below will have the desired effect, i.e. split the
                     * response into message number and unique identifier.
                     *
                     * Example for a malformed response:
                     * 1   2011071307115510400ae3e9e00bmu9
                     *
                     * Note the three spaces between message number and unique identifier.
                     * See issue 3546
                     */
                    String cleanedResponse = response.replaceAll("  +", " ");

                    String[] uidParts = cleanedResponse.split(" ");
                    if ((uidParts.length >= 3) && "+OK".equals(uidParts[0])) {
                        /*
                         * At least one server software places a "+OK" in