From 5269bc6563da187c5757e97465d2ced927ade7a8 Mon Sep 17 00:00:00 2001 From: cketti Date: Sun, 15 May 2011 16:23:53 +0200 Subject: [PATCH] Fix bug introduced with commit b7a6dbd9734700e3eacdaf1477fed14c03106e00 Fixes issue 3297 --- src/com/fsck/k9/mail/store/ImapStore.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 56e0f8a52..92d0cb778 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -377,9 +377,9 @@ public class ImapStore extends Store { if (ImapResponseParser.equalsIgnoreCase(response.get(0), commandResponse)) { boolean includeFolder = true; - String folder; + String decodedFolderName; try { - folder = decodeFolderName(response.getString(3)); + decodedFolderName = decodeFolderName(response.getString(3)); } catch (CharacterCodingException e) { Log.w(K9.LOG_TAG, "Folder name not correctly encoded with the UTF-7 variant " + "as defined by RFC 3501: " + response.getString(3), e); @@ -391,6 +391,8 @@ public class ImapStore extends Store { continue; } + String folder = decodedFolderName; + if (mPathDelimeter == null) { mPathDelimeter = response.getString(2); mCombinedPrefix = null; @@ -406,12 +408,13 @@ public class ImapStore extends Store { */ continue; } else { - - if (getCombinedPrefix().length() > 0) { - if (folder.length() >= getCombinedPrefix().length()) { - folder = folder.substring(getCombinedPrefix().length()); + int prefixLength = getCombinedPrefix().length(); + if (prefixLength > 0) { + // Strip prefix from the folder name + if (folder.length() >= prefixLength) { + folder = folder.substring(prefixLength); } - if (!folder.equalsIgnoreCase(getCombinedPrefix() + folder)) { + if (!decodedFolderName.equalsIgnoreCase(getCombinedPrefix() + folder)) { includeFolder = false; } }