1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 11:12:22 -05:00

Caldav: fix bug 2833044 Event not found error on dismissing reminders with events created in Outlook with a plus sign in subject

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@649 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-08-06 12:15:52 +00:00
parent b86da04306
commit 0515fca2b6

View File

@ -143,11 +143,7 @@ public class CaldavConnection extends AbstractConnection {
tokens = new StringTokenizer(line);
String command = tokens.nextToken();
Map<String, String> headers = parseHeaders();
String encodedPath = tokens.nextToken();
// make sure + sign in URL is encoded
if (encodedPath.indexOf('+') >= 0) {
encodedPath = encodedPath.replaceAll("\\+", "%2B");
}
String encodedPath = encodePlusSign(tokens.nextToken());
String path = URIUtil.decode(encodedPath);
String content = getContent(headers.get("content-length"));
setSocketTimeout(headers.get("keep-alive"));
@ -1035,6 +1031,20 @@ public class CaldavConnection extends AbstractConnection {
return result;
}
/**
* Make sure + sign in URL is encoded.
* @param path URL path
* @return reencoded path
*/
protected String encodePlusSign(String path) {
// make sure + sign in URL is encoded
if (path.indexOf('+') >= 0) {
return path.replaceAll("\\+", "%2B");
} else {
return path;
}
}
protected class CaldavRequest {
protected final String command;
protected final String path;
@ -1211,7 +1221,7 @@ public class CaldavConnection extends AbstractConnection {
if (isIcal()) {
hrefs.add(streamReader.getText());
} else {
hrefs.add(URIUtil.decode(streamReader.getText()));
hrefs.add(URIUtil.decode(encodePlusSign(streamReader.getText())));
}
}
inElement = false;