mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-18 09:48:12 +00:00
fix(dav): return 405 when collection already exists
See https://datatracker.ietf.org/doc/html/rfc4918#section-9.3.1
This commit is contained in:
1 parent
efe78c5179
commit
95eecc402a
8 files changed
+42
-21
No files matched your search
@@ -3076,15 +3076,15 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
}
|
||||
|
||||
/* folder management */
|
||||
- (BOOL) create
|
||||
- (NSException *) create
|
||||
{
|
||||
BOOL rc;
|
||||
SOGoUserSettings *userSettings;
|
||||
NSMutableDictionary *calendarSettings;
|
||||
NSException *error;
|
||||
SOGoUser *ownerUser;
|
||||
|
||||
rc = [super create];
|
||||
if (rc)
|
||||
error = [super create];
|
||||
if (!error)
|
||||
{
|
||||
ownerUser = [SOGoUser userWithLogin: [self ownerInContext: context]];
|
||||
userSettings = [ownerUser userSettings];
|
||||
@@ -3097,7 +3097,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir
|
||||
[userSettings synchronize];
|
||||
}
|
||||
|
||||
return rc;
|
||||
return error;
|
||||
}
|
||||
|
||||
- (void) removeFolderSettings: (NSMutableDictionary *) moduleSettings
|
||||
|
||||
@@ -398,20 +398,18 @@ static SoSecurityManager *sm = nil;
|
||||
if ([subfolderNames containsObject: newName])
|
||||
{
|
||||
content = [NSString stringWithFormat: @"A collection named '%@' already exists.", newName];
|
||||
error = [NSException exceptionWithDAVStatus: 403
|
||||
error = [NSException exceptionWithDAVStatus: 405
|
||||
reason: content];
|
||||
}
|
||||
else
|
||||
{
|
||||
properties = [[createContext request]
|
||||
davPatchedPropertiesWithTopTag: @"mkcalendar"];
|
||||
properties = [[createContext request] davPatchedPropertiesWithTopTag: @"mkcalendar"];
|
||||
setProperties = [properties objectForKey: @"set"];
|
||||
newDisplayName = [self _fetchPropertyWithName: @"{DAV:}displayname"
|
||||
inArray: setProperties];
|
||||
if (![newDisplayName length])
|
||||
newDisplayName = newName;
|
||||
error
|
||||
= [self newFolderWithName: newDisplayName andNameInContainer: newName];
|
||||
error = [self newFolderWithName: newDisplayName andNameInContainer: newName];
|
||||
if (!error)
|
||||
{
|
||||
newFolder = [self lookupName: newName
|
||||
|
||||
Reference in new issue
Block a user