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

View File

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