From 9f96639e6f7d75341efe46337deac8ddd339be24 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 28 Jun 2017 14:01:52 -0400 Subject: [PATCH] Ignore errors of nonexistent special mailboxes Fixes #4177 --- NEWS | 1 + UI/MailerUI/UIxMailFolderActions.m | 16 ++++++++++++---- UI/MailerUI/UIxMailListActions.m | 4 ++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 00f27bc031..d384992159 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,7 @@ Bug fixes - [web] respect SOGoLanguage and SOGoSupportedLanguages (#4169) - [web] fixed adding list members with multiple email addresses - [web] fixed responsive condition of login page (960px to 1023px) + - [web] don't throw errors when accessing nonexistent special mailboxes (#4177) - [core] newly subscribed calendars are excluded from freebusy (#3354) - [core] don't update subscriptions when owner is not the active user (#3988) - [core] strip cr during LDIF import process (#4172) diff --git a/UI/MailerUI/UIxMailFolderActions.m b/UI/MailerUI/UIxMailFolderActions.m index 82fbdf2bfc..17c4b140d5 100644 --- a/UI/MailerUI/UIxMailFolderActions.m +++ b/UI/MailerUI/UIxMailFolderActions.m @@ -714,9 +714,17 @@ - (WOResponse *) expungeAction error = [co expunge]; if (error) { - data = [NSDictionary dictionaryWithObject: [self labelForKey: @"Unable to expunge folder." inContext: context] - forKey: @"message"]; - response = [self responseWithStatus: 500 andJSONRepresentation: data]; + if ([co isSpecialFolder]) + { + // Special folder probably doesn't exist; ignore error. + response = [self responseWithStatus: 204]; + } + else + { + data = [NSDictionary dictionaryWithObject: [self labelForKey: @"Unable to expunge folder." inContext: context] + forKey: @"message"]; + response = [self responseWithStatus: 500 andJSONRepresentation: data]; + } } else { @@ -730,7 +738,7 @@ - (WOResponse *) expungeAction response = [self responseWithStatus: 200 andJSONRepresentation: data]; } else - response = [self responseWithStatus: 200]; + response = [self responseWithStatus: 204]; } return response; diff --git a/UI/MailerUI/UIxMailListActions.m b/UI/MailerUI/UIxMailListActions.m index 8436b3a686..293473291f 100644 --- a/UI/MailerUI/UIxMailListActions.m +++ b/UI/MailerUI/UIxMailListActions.m @@ -767,6 +767,10 @@ - (NSDictionary *) getUIDsInFolder: (SOGoMailFolder *) folder if (data != nil) response = [self responseWithStatus: 200 andJSONRepresentation: data]; + else if ([folder isSpecialFolder]) + { + response = [self responseWithStatus: 204]; + } else { data = [NSDictionary dictionaryWithObjectsAndKeys: