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

Carddav: fix GET request on folder support for SOGO

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1249 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-21 16:20:33 +00:00
parent 7b29cb2e1e
commit 3637d8fb4b
2 changed files with 9 additions and 5 deletions

View File

@ -274,7 +274,7 @@ public class CaldavConnection extends AbstractConnection {
ExchangeSession.Folder folder = session.getFolder(folderPath);
if (folder.isContact()) {
sendHttpResponse(HttpStatus.SC_OK, buildEtagHeader(folder.etag), "text/vcard", (byte[]) null, true);
} else {
} else if (folder.isCalendar()) {
List<ExchangeSession.Event> events = session.getAllEvents(folderPath);
ChunkedResponse response = new ChunkedResponse(HttpStatus.SC_OK, "text/calendar;charset=UTF-8");
response.append("BEGIN:VCALENDAR\r\n");
@ -297,6 +297,8 @@ public class CaldavConnection extends AbstractConnection {
}
response.append("END:VCALENDAR");
response.close();
} else {
sendHttpResponse(HttpStatus.SC_OK, buildEtagHeader(folder.etag), "text/html", (byte[]) null, true);
}
} else {
ExchangeSession.Item item = session.getItem(request.getFolderPath(), lastPath);
@ -1255,7 +1257,7 @@ public class CaldavConnection extends AbstractConnection {
* @return true if this is a folder (not event) request
*/
public boolean isFolder() {
return isPropFind() || isReport() || isPropPatch() || isOptions() || isPost();
return path.endsWith("/") || isPropFind() || isReport() || isPropPatch() || isOptions() || isPost();
}
public boolean isRoot() {

View File

@ -1050,9 +1050,11 @@ public class EwsExchangeSession extends ExchangeSession {
private FolderId getFolderIdIfExists(String folderPath) throws IOException {
String[] folderNames;
FolderId currentFolderId;
String currentMailboxPath = "/users/" + email + '/';
if (folderPath.startsWith(currentMailboxPath)) {
return getFolderIdIfExists(folderPath.substring(currentMailboxPath.length()));
String currentMailboxPath = "/users/" + email;
if (currentMailboxPath.equals(folderPath)) {
return DistinguishedFolderId.MSGFOLDERROOT;
} else if (folderPath.startsWith(currentMailboxPath + '/')) {
return getFolderIdIfExists(folderPath.substring(currentMailboxPath.length()+1));
}
if (folderPath.startsWith(PUBLIC_ROOT)) {
currentFolderId = DistinguishedFolderId.PUBLICFOLDERSROOT;