From 25403fe07ac299ba44208a7c8cea7d673a37d732 Mon Sep 17 00:00:00 2001 From: mguessan Date: Mon, 2 Mar 2009 16:03:34 +0000 Subject: [PATCH] IMAP: Encode folder path on create git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@408 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/exchange/ExchangeSession.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index d2528bc7..d3f8e9ca 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -21,7 +21,6 @@ import org.htmlcleaner.CommentToken; import org.htmlcleaner.HtmlCleaner; import org.htmlcleaner.TagNode; -import javax.mail.BodyPart; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; @@ -146,7 +145,7 @@ public class ExchangeSession { return DavGatewayHttpClientFacade.getHttpStatus(url) == HttpStatus.SC_UNAUTHORIZED; } - protected String getAbsolutePath(HttpMethod method, String path) throws URIException { + protected String getAbsolutePathOrUri(HttpMethod method, String path) throws URIException { if (path == null) { return method.getURI().getURI(); } else if (path.startsWith("/")) { @@ -184,7 +183,7 @@ public class ExchangeSession { TagNode form = (TagNode) forms.get(0); String logonMethodPath = form.getAttributeByName("action"); - logonMethod = new PostMethod(getAbsolutePath(initmethod, logonMethodPath)); + logonMethod = new PostMethod(getAbsolutePathOrUri(initmethod, logonMethodPath)); List inputList = form.getElementListByName("input", true); for (Object input : inputList) { @@ -221,7 +220,7 @@ public class ExchangeSession { int a_sUrlEndIndex = scriptValue.indexOf("\"", a_sUrlIndex); int a_sLgnEndIndex = scriptValue.indexOf("\"", a_sLgnIndex); if (a_sUrlEndIndex >= 0 && a_sLgnEndIndex >= 0) { - String src = getAbsolutePath(initmethod, + String src = getAbsolutePathOrUri(initmethod, scriptValue.substring(a_sLgnIndex, a_sLgnEndIndex) + scriptValue.substring(a_sUrlIndex, a_sUrlEndIndex)); LOGGER.debug("Detected script based logon, redirect to form at " + src); @@ -862,7 +861,7 @@ public class ExchangeSession { public void createFolder(String folderName) throws IOException { String folderPath = getFolderPath(folderName); - PropPatchMethod method = new PropPatchMethod(folderPath) { + PropPatchMethod method = new PropPatchMethod(URIUtil.encodePath(folderPath)) { public String getName() { return "MKCOL"; }