(fix) avoid exception on recent GNUstep when attached file has no filename (fixes #4702)

This commit is contained in:
Ludovic Marcotte
2019-03-18 10:28:33 -04:00
parent 6fa7d43e7a
commit 933cd581dd
2 changed files with 7 additions and 6 deletions
+6 -6
View File
@@ -36,6 +36,7 @@
#import <Mailer/NSData+Mail.h>
#import <Mailer/NSDictionary+Mail.h>
#import <Mailer/SOGoMailBodyPart.h>
#import <Mailer/SOGoMailObject.h>
#import "MailerUI/WOContext+UIxMailer.h"
#import "UIxMailRenderingContext.h"
@@ -303,15 +304,14 @@
NSMutableString *filename;
NSString *extension;
filename = [NSMutableString stringWithString: [self filename]];
if ([filename length])
if ([[self filename] length])
// We replace any slash by a dash since Apache won't allow encoded slashes by default.
// See http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes
filename = [NSMutableString stringWithString: [filename stringByReplacingString: @"/" withString: @"-"]];
filename = [NSMutableString stringWithString: [[self filename] stringByReplacingString: @"/" withString: @"-"]];
else
[filename appendFormat: @"%@-%@",
[self labelForKey: @"Untitled"],
[bodyPart nameInContainer]];
filename = [NSMutableString stringWithFormat: @"%@-%@",
[self labelForKey: @"Untitled"],
[bodyPart nameInContainer]];
if (![[filename pathExtension] length])
{