Caldav: avoid duplicate / in event path

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@530 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-04-17 09:20:47 +00:00
parent 4e81ef3828
commit b099a9aaa0
1 changed files with 9 additions and 3 deletions

View File

@ -265,8 +265,14 @@ public class CaldavConnection extends AbstractConnection {
} }
protected void appendEventResponse(CaldavResponse response, CaldavRequest request, ExchangeSession.Event event) throws IOException { protected void appendEventResponse(CaldavResponse response, CaldavRequest request, ExchangeSession.Event event) throws IOException {
String eventPath = xmlEncodeName(event.getPath()); StringBuilder eventPath = new StringBuilder();
response.startResponse(URIUtil.encodePath(request.getPath()) + "/" + URIUtil.encodeWithinQuery(eventPath)); eventPath.append(URIUtil.encodePath(request.getPath()));
if (!(eventPath.charAt(eventPath.length()-1) == '/')) {
eventPath.append('/');
}
String eventName = xmlEncodeName(event.getPath());
eventPath.append(URIUtil.encodeWithinQuery(eventName));
response.startResponse(eventPath.toString());
response.startPropstat(); response.startPropstat();
if (request.hasProperty("calendar-data")) { if (request.hasProperty("calendar-data")) {
response.appendCalendarData(event.getICS()); response.appendCalendarData(event.getICS());
@ -281,7 +287,7 @@ public class CaldavConnection extends AbstractConnection {
response.appendProperty("D:resourcetype"); response.appendProperty("D:resourcetype");
} }
if (request.hasProperty("displayname")) { if (request.hasProperty("displayname")) {
response.appendProperty("D:displayname", eventPath); response.appendProperty("D:displayname", eventName);
} }
response.endPropStatOK(); response.endPropStatOK();
response.endResponse(); response.endResponse();