diff --git a/src/java/davmail/caldav/CaldavConnection.java b/src/java/davmail/caldav/CaldavConnection.java index 5ae8136e..c0d846ab 100644 --- a/src/java/davmail/caldav/CaldavConnection.java +++ b/src/java/davmail/caldav/CaldavConnection.java @@ -214,10 +214,10 @@ public class CaldavConnection extends AbstractConnection { if (request.isPropFind() && request.isPathLength(3)) { sendUserRoot(request); } else { - handleCalendar(request, 3); + handleCalendar(request); } } else if (request.isPath(1, "public")) { - handleCalendar(request, 2); + handleCalendar(request); } else { sendUnsupported(request); } @@ -233,63 +233,58 @@ public class CaldavConnection extends AbstractConnection { } else { sendUnsupported(request); } - } else if (request.isPath(2, "public") && request.isPathLength(4)) { - sendPrincipal(request, "public", request.getPathElement(3)); + } else if (request.isPath(2, "public")) { + StringBuilder prefixBuffer = new StringBuilder("public"); + for (int i=3; i buildEtagHeader(String etag) { @@ -713,7 +708,7 @@ public class CaldavConnection extends AbstractConnection { if ("users".equals(prefix)) { response.appendHrefProperty("C:calendar-home-set", "/users/" + actualPrincipal + "/calendar"); } else { - response.appendHrefProperty("C:calendar-home-set", prefix + '/' + actualPrincipal); + response.appendHrefProperty("C:calendar-home-set", '/' + prefix + '/' + actualPrincipal); } } @@ -1323,7 +1318,7 @@ public class CaldavConnection extends AbstractConnection { public void startResponse(String href) throws IOException { writer.write(""); writer.write(""); - writer.write(href); + writer.write(xmlEncodeName(href)); writer.write(""); } @@ -1342,7 +1337,7 @@ public class CaldavConnection extends AbstractConnection { } public void appendHrefProperty(String propertyName, String propertyValue) throws IOException { - appendProperty(propertyName, null, "" + URIUtil.encodePath(propertyValue) + ""); + appendProperty(propertyName, null, "" + URIUtil.encodePath(xmlEncodeName(propertyValue)) + ""); } public void appendProperty(String propertyName) throws IOException {