From 12993e45bed4ceb98edf08fd1d4909820650b66a Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Thu, 13 Jul 2017 10:45:18 -0400 Subject: [PATCH] (fix) fixed forwarding mails with attachments containing slashes in file names --- NEWS | 1 + SoObjects/Mailer/SOGoDraftObject.m | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 3fe6c1638..5abe82a84 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ New features Bug fixes - [web] use the organizer's alarm by default when accepting IMIP messages (#3934) + - [web] fixed forwarding mails with attachments containing slashes in file names - [eas] don't include task folders if we hide them in SOGo (#4164) - [core] not using cleaned data when sending mails (#4199) - [core] don't update subscriptions when owner is not the active user (#3988) diff --git a/SoObjects/Mailer/SOGoDraftObject.m b/SoObjects/Mailer/SOGoDraftObject.m index 1b21ff364..7bd3565fd 100644 --- a/SoObjects/Mailer/SOGoDraftObject.m +++ b/SoObjects/Mailer/SOGoDraftObject.m @@ -1158,7 +1158,14 @@ static NSString *userAgent = nil; name = [name substringFromIndex: r.location + 1]; if (![self isValidAttachmentName: name]) - return [self invalidAttachmentNameError: name]; + { + if ([name rangeOfString: @"/"].length) + { + name = [name stringByReplacingOccurrencesOfString: @"/" withString: @"-"]; + } + else + return [self invalidAttachmentNameError: name]; + } p = [self pathToAttachmentWithName: name]; if (![_attach writeToFile: p atomically: YES])