This is an automated email from the ASF dual-hosted git repository. rcordier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 3cba6dc30a2c8d5eda2988112a4892ea5c3be60d Author: Jan-Eric Hellenberg <janeric.hellenb...@gmail.com> AuthorDate: Fri Jan 3 11:41:01 2025 +0100 James-4099 Ensure properly using the mailbox session path delimiter when escaping usernames --- .../main/java/org/apache/james/imap/main/PathConverter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java b/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java index f57cc3e3c1..2ed8adee7b 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/main/PathConverter.java @@ -63,15 +63,16 @@ public interface PathConverter { class Default implements PathConverter { private static final int NAMESPACE = 0; private static final int USER = 1; - public static final Escaper USERNAME_ESCAPER = Escapers.builder() - .addEscape('.', "__") - .addEscape('_', "_-") - .build(); private final MailboxSession mailboxSession; + private final Escaper usernameEscaper; private Default(MailboxSession mailboxSession) { this.mailboxSession = mailboxSession; + this.usernameEscaper = Escapers.builder() + .addEscape(mailboxSession.getPathDelimiter(), "__") + .addEscape('_', "_-") + .build(); } public MailboxPath buildFullPath(String mailboxName) { @@ -151,7 +152,7 @@ public interface PathConverter { sb.append(session.getPathDelimiter()); } - sb.append(USERNAME_ESCAPER.escape(mailboxPath.getUser().getLocalPart())); + sb.append(usernameEscaper.escape(mailboxPath.getUser().getLocalPart())); } } if (mailboxPath.getName() != null && !mailboxPath.getName().isEmpty()) { --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org For additional commands, e-mail: notifications-h...@james.apache.org