diff --git a/src/java/davmail/exchange/ews/EwsExchangeSession.java b/src/java/davmail/exchange/ews/EwsExchangeSession.java index b7929a61..4d29dc8b 100644 --- a/src/java/davmail/exchange/ews/EwsExchangeSession.java +++ b/src/java/davmail/exchange/ews/EwsExchangeSession.java @@ -148,10 +148,14 @@ public class EwsExchangeSession extends ExchangeSession { // check EWS access try { checkEndPointUrl("/ews/exchange.asmx"); + // workaround for Exchange bug: send fake request + internalGetFolder(""); } catch (IOException e) { try { // failover, try to retrieve EWS url from autodiscover checkEndPointUrl(getEwsUrlFromAutoDiscover()); + // workaround for Exchange bug: send fake request + internalGetFolder(""); } catch (IOException e2) { // autodiscover failed and initial exception was authentication failure => throw original exception if (e instanceof DavMailAuthenticationException) { @@ -164,8 +168,6 @@ public class EwsExchangeSession extends ExchangeSession { try { folderIdMap = new HashMap(); - // workaround for Exchange bug: send fake request - internalGetFolder(""); // load actual well known folder ids folderIdMap.put(internalGetFolder(INBOX).folderId.value, INBOX); folderIdMap.put(internalGetFolder(CALENDAR).folderId.value, CALENDAR); diff --git a/src/java/davmail/http/DavGatewayHttpClientFacade.java b/src/java/davmail/http/DavGatewayHttpClientFacade.java index fc3898b1..ff45d486 100644 --- a/src/java/davmail/http/DavGatewayHttpClientFacade.java +++ b/src/java/davmail/http/DavGatewayHttpClientFacade.java @@ -303,6 +303,10 @@ public final class DavGatewayHttpClientFacade { if (locationValue.indexOf('"') >= 0) { locationValue = URIUtil.encodePath(locationValue); } + // workaround for invalid relative location + if (locationValue.startsWith("./")) { + locationValue = locationValue.substring(1); + } currentMethod.releaseConnection(); currentMethod = new GetMethod(locationValue); currentMethod.setFollowRedirects(false);