Fix public URL with special characters

Fixes #3993
pull/234/head
Francis Lachapelle 2017-01-30 21:56:33 -05:00
parent abccdd304f
commit 539a6c3beb
2 changed files with 12 additions and 3 deletions

2
NEWS
View File

@ -6,6 +6,8 @@ Enhancements
Bug fixes Bug fixes
- [web] saving the preferences was not possible when Mail module is disabled - [web] saving the preferences was not possible when Mail module is disabled
- [web] ignore mouse events in scrollbars of Month view (#3990)
- [web] fixed public URL with special characters (#3993)
3.2.6a (2017-01-26) 3.2.6a (2017-01-26)
------------------- -------------------

View File

@ -471,10 +471,17 @@ static NSArray *childRecordFields = nil;
{ {
NSMutableArray *newPath; NSMutableArray *newPath;
NSURL *davURL; NSURL *davURL;
unsigned int max, count;
davURL = [self realDavURL]; davURL = [self realDavURL];
newPath = [NSMutableArray arrayWithArray: [[davURL path] componentsSeparatedByString: @"/"]]; newPath = [NSMutableArray arrayWithArray: [[davURL path] componentsSeparatedByString: @"/"]];
[newPath insertObject: @"public" atIndex: 3]; [newPath insertObject: @"public" atIndex: 3];
max = [newPath count];
for (count = 0; count < max; count++)
[newPath replaceObjectAtIndex: count
withObject: [[newPath objectAtIndex: count] stringByEscapingURL]];
davURL = [NSURL URLWithString: [newPath componentsJoinedByString: @"/"] davURL = [NSURL URLWithString: [newPath componentsJoinedByString: @"/"]
relativeToURL: davURL]; relativeToURL: davURL];
@ -495,9 +502,9 @@ static NSArray *childRecordFields = nil;
publicParticle = @""; publicParticle = @"";
path = [NSString stringWithFormat: @"/%@/dav%@/%@/%@/%@/", path = [NSString stringWithFormat: @"/%@/dav%@/%@/%@/%@/",
appName, publicParticle, appName, publicParticle,
[self ownerInContext: nil], [[self ownerInContext: nil] stringByEscapingURL],
[container nameInContainer], [[container nameInContainer] stringByEscapingURL],
[self realNameInContainer]]; [[self realNameInContainer] stringByEscapingURL]];
currentDavURL = [self davURL]; currentDavURL = [self davURL];
realDavURL = [NSURL URLWithString: path relativeToURL: currentDavURL]; realDavURL = [NSURL URLWithString: path relativeToURL: currentDavURL];
} }