diff --git a/src/java/davmail/caldav/CaldavConnection.java b/src/java/davmail/caldav/CaldavConnection.java index 410ff2dc..07a34cda 100644 --- a/src/java/davmail/caldav/CaldavConnection.java +++ b/src/java/davmail/caldav/CaldavConnection.java @@ -7,6 +7,7 @@ import davmail.exchange.ExchangeSessionFactory; import davmail.tray.DavGatewayTray; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.util.URIUtil; import org.apache.commons.httpclient.auth.AuthenticationException; import org.apache.log4j.Logger; @@ -256,7 +257,7 @@ public class CaldavConnection extends AbstractConnection { protected void appendEventResponse(StringBuilder buffer, CaldavRequest request, ExchangeSession.Event event) throws IOException { String eventPath = event.getPath().replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">"); buffer.append(""); - buffer.append("/users/").append(session.getEmail()).append("/calendar").append(eventPath).append(""); + buffer.append("/users/").append(session.getEmail()).append("/calendar").append(URIUtil.encodePath(eventPath)).append(""); buffer.append(""); buffer.append(""); if (request.hasProperty("calendar-data")) { @@ -459,7 +460,7 @@ public class CaldavConnection extends AbstractConnection { // send not found events errors for (String href : notFound) { buffer.append(""); - buffer.append("").append(href).append(""); + buffer.append("").append(URIUtil.encodePath(href)).append(""); buffer.append(""); buffer.append("HTTP/1.1 404 Not Found"); buffer.append(""); @@ -769,7 +770,7 @@ public class CaldavConnection extends AbstractConnection { if (hrefs == null) { hrefs = new HashSet(); } - hrefs.add(streamReader.getText()); + hrefs.add(URIUtil.decode(streamReader.getText())); } inElement = false; }