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

Carddav: encode contact picture url

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1248 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-21 15:48:34 +00:00
parent a2ddfeb643
commit 7b29cb2e1e

View File

@ -648,13 +648,13 @@ public class DavExchangeSession extends ExchangeSession {
} }
itemResult.status = status; itemResult.status = status;
String contactPictureUrl = getHref() + "/ContactPicture.jpg"; String contactPictureUrl = URIUtil.encodePath(getHref() + "/ContactPicture.jpg");
String photo = get("photo"); String photo = get("photo");
if (photo != null) { if (photo != null) {
// need to update photo // need to update photo
byte[] resizedImageBytes = IOUtil.resizeImage(Base64.decodeBase64(photo.getBytes()), 90); byte[] resizedImageBytes = IOUtil.resizeImage(Base64.decodeBase64(photo.getBytes()), 90);
final PutMethod putmethod = new PutMethod(URIUtil.encodePath(contactPictureUrl)); final PutMethod putmethod = new PutMethod(contactPictureUrl);
putmethod.setRequestHeader("Overwrite", "t"); putmethod.setRequestHeader("Overwrite", "t");
putmethod.setRequestHeader("Content-Type", "image/jpeg"); putmethod.setRequestHeader("Content-Type", "image/jpeg");
putmethod.setRequestEntity(new ByteArrayRequestEntity(resizedImageBytes, "image/jpeg")); putmethod.setRequestEntity(new ByteArrayRequestEntity(resizedImageBytes, "image/jpeg"));