From 1cf68fa730f0d566c937754fb4b35271dea53cf5 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 8 Jul 2011 20:02:02 +0000 Subject: [PATCH] Monotone-Parent: 31c616af5df5ea18c34f33008cee7ec5688b43ba Monotone-Revision: 1c03128dc32222b38a2456aa650fb2b5a775c3a0 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-07-08T20:02:02 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 11 +++++++++++ OpenChange/MAPIStoreContext.m | 2 +- OpenChange/MAPIStoreFSFolder.m | 4 +++- OpenChange/MAPIStoreFolder.m | 4 +++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97ed5d0e2..746c617a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-07-08 Wolfgang Sourdeau + * OpenChange/MAPIStoreFolder.m (-initWithSOstringByAddingPercentEscapesUsingEncodinGoObject:inContainer:): + make use of -[NSString stringByAddingPercentEscapesUsingEncoding:] + to properly escape folder names with non-ascii characters. + + * OpenChange/MAPIStoreFSFolder.m (-createFolder:withFID:): same as + above. + + * OpenChange/MAPIStoreContext.m + (+contextFromURI:withConnectionInfo:andFID:inMemCtx:): same as + above. + * OpenChange/SOGoMAPIFSFolder.m (-initWithName:inContainer:): added method to properly initialize the "directory" ivar when initialized as a subfolder. diff --git a/OpenChange/MAPIStoreContext.m b/OpenChange/MAPIStoreContext.m index f84f9d7aa..c81001a93 100644 --- a/OpenChange/MAPIStoreContext.m +++ b/OpenChange/MAPIStoreContext.m @@ -161,7 +161,7 @@ _prepareContextClass (struct mapistore_context *newMemCtx, completeURLString = [@"sogo://" stringByAppendingString: urlString]; if (![completeURLString hasSuffix: @"/"]) completeURLString = [completeURLString stringByAppendingString: @"/"]; - baseURL = [NSURL URLWithString: completeURLString]; + baseURL = [NSURL URLWithString: [completeURLString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]]; if (baseURL) { module = [baseURL host]; diff --git a/OpenChange/MAPIStoreFSFolder.m b/OpenChange/MAPIStoreFSFolder.m index b4582e732..81de081f6 100644 --- a/OpenChange/MAPIStoreFSFolder.m +++ b/OpenChange/MAPIStoreFSFolder.m @@ -80,12 +80,14 @@ static Class MAPIStoreFSMessageK; withFID: (uint64_t) newFID { NSString *newKey, *urlString; + NSURL *childURL; SOGoMAPIFSFolder *childFolder; newKey = [NSString stringWithFormat: @"0x%.16"PRIx64, (unsigned long long) newFID]; urlString = [NSString stringWithFormat: @"%@/%@", [self url], newKey]; - childFolder = [SOGoMAPIFSFolder folderWithURL: [NSURL URLWithString: urlString] + childURL = [NSURL URLWithString: [urlString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]]; + childFolder = [SOGoMAPIFSFolder folderWithURL: childURL andTableType: MAPISTORE_MESSAGE_TABLE]; [childFolder ensureDirectory]; diff --git a/OpenChange/MAPIStoreFolder.m b/OpenChange/MAPIStoreFolder.m index 2bfc24273..3f1234442 100644 --- a/OpenChange/MAPIStoreFolder.m +++ b/OpenChange/MAPIStoreFolder.m @@ -118,10 +118,12 @@ Class NSExceptionK, MAPIStoreMessageTableK, MAPIStoreFAIMessageTableK, MAPIStore inContainer: (MAPIStoreObject *) newContainer { NSURL *propsURL; + NSString *urlString; if ((self = [super initWithSOGoObject: newSOGoObject inContainer: newContainer])) { - propsURL = [NSURL URLWithString: [self url]]; + urlString = [[self url] stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; + propsURL = [NSURL URLWithString: urlString]; ASSIGN (propsFolder, [SOGoMAPIFSFolder folderWithURL: propsURL andTableType: MAPISTORE_FOLDER_TABLE]);