Skip to content

Commit

Permalink
(fix) avoid exception on recent GNUstep when attached file has no fil…
Browse files Browse the repository at this point in the history
…ename (fixes #4702)
  • Loading branch information
extrafu committed Mar 18, 2019
1 parent 6fa7d43 commit 933cd58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -11,6 +11,7 @@ Bug fixes
- [core] allow super users to modify any event (#4216)
- [core] correctly handle the full cert chain in S/MIME
- [core] handle multidays events in freebusy data
- [core] avoid exception on recent GNUstep when attached file has no filename (#4702)

4.0.7 (2019-02-27)
------------------
Expand Down
12 changes: 6 additions & 6 deletions UI/MailPartViewers/UIxMailPartViewer.m
Expand Up @@ -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"
Expand Down Expand Up @@ -303,15 +304,14 @@ - (NSString *) _filenameForAttachment: (SOGoMailBodyPart *) bodyPart
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])
{
Expand Down

0 comments on commit 933cd58

Please sign in to comment.