Monotone-Parent: 1fb3121c84e0bb2773973fcfde109c7b26530951
Monotone-Revision: e2f910a1982b774a3f5dfd586d968821441f2076 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-08-17T17:56:25 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
90e226d5bb
commit
fb297c913c
|
@ -1,3 +1,9 @@
|
||||||
|
2012-08-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* OpenChange/MAPIStoreContext.m (-getPath:ofFMID:inMemCtx:):
|
||||||
|
properly escape urls containing non-ascii chars.
|
||||||
|
(-getRootFoldeR:withFID:): idem.
|
||||||
|
|
||||||
2012-08-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2012-08-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
* OpenChange/MAPIStoreCalendarMessage.m
|
* OpenChange/MAPIStoreCalendarMessage.m
|
||||||
|
|
|
@ -366,7 +366,8 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
NSString *objectURL, *url;
|
NSString *objectURL, *url;
|
||||||
// TDB_DATA key, dbuf;
|
// TDB_DATA key, dbuf;
|
||||||
|
|
||||||
url = [contextUrl absoluteString];
|
url = [[contextUrl absoluteString]
|
||||||
|
stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
objectURL = [[userContext mapping] urlFromID: fmid];
|
objectURL = [[userContext mapping] urlFromID: fmid];
|
||||||
if (objectURL)
|
if (objectURL)
|
||||||
{
|
{
|
||||||
|
@ -417,15 +418,18 @@ static inline NSURL *CompleteURLFromMapistoreURI (const char *uri)
|
||||||
MAPIStoreFolder *baseFolder;
|
MAPIStoreFolder *baseFolder;
|
||||||
SOGoFolder *currentFolder;
|
SOGoFolder *currentFolder;
|
||||||
WOContext *woContext;
|
WOContext *woContext;
|
||||||
NSString *path;
|
NSString *path, *urlString;
|
||||||
NSArray *pathComponents;
|
NSArray *pathComponents;
|
||||||
NSUInteger count, max;
|
NSUInteger count, max;
|
||||||
|
|
||||||
mapping = [userContext mapping];
|
mapping = [userContext mapping];
|
||||||
if (![mapping urlFromID: newFid])
|
if (![mapping urlFromID: newFid])
|
||||||
[mapping registerURL: [contextUrl absoluteString]
|
{
|
||||||
withID: newFid];
|
urlString = [[contextUrl absoluteString]
|
||||||
|
stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
|
[mapping registerURL: urlString
|
||||||
|
withID: newFid];
|
||||||
|
}
|
||||||
[userContext activateWithUser: activeUser];
|
[userContext activateWithUser: activeUser];
|
||||||
woContext = [userContext woContext];
|
woContext = [userContext woContext];
|
||||||
|
|
||||||
|
|
|
@ -94,12 +94,14 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
{
|
{
|
||||||
NSURL *folderURL;
|
NSURL *folderURL;
|
||||||
NSMutableString *pathPrefix;
|
NSMutableString *pathPrefix;
|
||||||
NSString *path, *folderName;
|
NSString *path, *escapedURL, *folderName;
|
||||||
NSArray *parts;
|
NSArray *parts;
|
||||||
NSUInteger lastPartIdx;
|
NSUInteger lastPartIdx;
|
||||||
MAPIStoreUserContext *userContext;
|
MAPIStoreUserContext *userContext;
|
||||||
|
|
||||||
folderURL = [NSURL URLWithString: [self url]];
|
escapedURL = [[self url]
|
||||||
|
stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
|
folderURL = [NSURL URLWithString: escapedURL];
|
||||||
path = [folderURL path];
|
path = [folderURL path];
|
||||||
path = [path substringFromIndex: 1];
|
path = [path substringFromIndex: 1];
|
||||||
if ([path length] > 0)
|
if ([path length] > 0)
|
||||||
|
@ -1495,7 +1497,8 @@ Class NSExceptionK, MAPIStoreFAIMessageK, MAPIStoreMessageTableK, MAPIStoreFAIMe
|
||||||
url = [NSString stringWithFormat: @"%@/", [super url]];
|
url = [NSString stringWithFormat: @"%@/", [super url]];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
url = [[context url] absoluteString];
|
url = [[[context url] absoluteString]
|
||||||
|
stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
if (![url hasSuffix: @"/"])
|
if (![url hasSuffix: @"/"])
|
||||||
url = [NSString stringWithFormat: @"%@/", url];
|
url = [NSString stringWithFormat: @"%@/", url];
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,12 +206,14 @@ MakeDisplayFolderName (NSString *folderName)
|
||||||
|
|
||||||
- (void) updateURLWithFolderName: (NSString *) newFolderName
|
- (void) updateURLWithFolderName: (NSString *) newFolderName
|
||||||
{
|
{
|
||||||
NSString *urlString;
|
NSString *urlString, *escapedName;
|
||||||
NSMutableArray *pathComponents;
|
NSMutableArray *pathComponents;
|
||||||
BOOL hasSlash;
|
BOOL hasSlash;
|
||||||
NSUInteger max, folderNameIdx;
|
NSUInteger max, folderNameIdx;
|
||||||
NSURL *newURL;
|
NSURL *newURL;
|
||||||
|
|
||||||
|
/* we do not need to unescape the url here as it will be reassembled later
|
||||||
|
in the method */
|
||||||
urlString = [contextUrl absoluteString];
|
urlString = [contextUrl absoluteString];
|
||||||
hasSlash = [urlString hasSuffix: @"/"];
|
hasSlash = [urlString hasSuffix: @"/"];
|
||||||
pathComponents = [[urlString componentsSeparatedByString: @"/"]
|
pathComponents = [[urlString componentsSeparatedByString: @"/"]
|
||||||
|
@ -222,8 +224,9 @@ MakeDisplayFolderName (NSString *folderName)
|
||||||
folderNameIdx = max - 2;
|
folderNameIdx = max - 2;
|
||||||
else
|
else
|
||||||
folderNameIdx = max - 1;
|
folderNameIdx = max - 1;
|
||||||
|
escapedName = [newFolderName stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
|
||||||
[pathComponents replaceObjectAtIndex: folderNameIdx
|
[pathComponents replaceObjectAtIndex: folderNameIdx
|
||||||
withObject: [newFolderName stringByEscapingURL]];
|
withObject: escapedName];
|
||||||
urlString = [pathComponents componentsJoinedByString: @"/"];
|
urlString = [pathComponents componentsJoinedByString: @"/"];
|
||||||
newURL = [NSURL URLWithString: urlString];
|
newURL = [NSURL URLWithString: urlString];
|
||||||
ASSIGN (contextUrl, newURL);
|
ASSIGN (contextUrl, newURL);
|
||||||
|
|
|
@ -1046,15 +1046,15 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
||||||
folderURL = [sogoObject imap4URL];
|
folderURL = [sogoObject imap4URL];
|
||||||
if (!newFolderName)
|
if (!newFolderName)
|
||||||
newFolderName = [sogoObject displayName];
|
newFolderName = [sogoObject displayName];
|
||||||
newFolderName = [newFolderName stringByEscapingURL];
|
|
||||||
targetSOGoFolder = [targetFolder sogoObject];
|
targetSOGoFolder = [targetFolder sogoObject];
|
||||||
newFolderURL = [NSURL URLWithString: newFolderName
|
|
||||||
relativeToURL: [targetSOGoFolder imap4URL]];
|
|
||||||
if (isMove)
|
if (isMove)
|
||||||
{
|
{
|
||||||
|
newFolderURL = [NSURL
|
||||||
|
URLWithString: [newFolderName stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]
|
||||||
|
relativeToURL: [targetSOGoFolder imap4URL]];
|
||||||
error = [[sogoObject imap4Connection]
|
error = [[sogoObject imap4Connection]
|
||||||
moveMailboxAtURL: folderURL
|
moveMailboxAtURL: folderURL
|
||||||
toURL: newFolderURL];
|
toURL: newFolderURL];
|
||||||
if (error)
|
if (error)
|
||||||
rc = MAPISTORE_ERR_DENIED;
|
rc = MAPISTORE_ERR_DENIED;
|
||||||
else
|
else
|
||||||
|
@ -1063,8 +1063,7 @@ _parseCOPYUID (NSString *line, NSArray **destUIDsP)
|
||||||
mapping = [self mapping];
|
mapping = [self mapping];
|
||||||
newURL = [NSString stringWithFormat: @"%@folder%@/",
|
newURL = [NSString stringWithFormat: @"%@folder%@/",
|
||||||
[targetFolder url], newFolderName];
|
[targetFolder url], newFolderName];
|
||||||
[mapping updateID: [self objectId]
|
[mapping updateID: [self objectId] withURL: newURL];
|
||||||
withURL: newURL];
|
|
||||||
parentDBFolderPath = [[targetFolder dbFolder] path];
|
parentDBFolderPath = [[targetFolder dbFolder] path];
|
||||||
if (!parentDBFolderPath)
|
if (!parentDBFolderPath)
|
||||||
parentDBFolderPath = @"";
|
parentDBFolderPath = @"";
|
||||||
|
|
Loading…
Reference in a new issue