parent
d549c296ae
commit
9c391b8d8d
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2007-2014 Inverse inc.
|
||||
Copyright (C) 2007-2020 Inverse inc.
|
||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||
|
||||
This file is part of SOGo.
|
||||
|
@ -112,7 +112,7 @@
|
|||
- (NGMimeBodyPart *) bodyPartForAttachmentWithName: (NSString *) _name;
|
||||
- (NSString *) pathToAttachmentWithName: (NSString *) _name;
|
||||
- (NSException *) saveAttachment: (NSData *) _attach
|
||||
withMetadata: (NSDictionary *) metadata;
|
||||
withMetadata: (NSMutableDictionary *) metadata;
|
||||
- (NSException *) deleteAttachmentWithName: (NSString *) _name;
|
||||
|
||||
/* NGMime representations */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2007-2018 Inverse inc.
|
||||
Copyright (C) 2007-2020 Inverse inc.
|
||||
Copyright (C) 2004-2005 SKYRIX Software AG
|
||||
|
||||
This file is part of SOGo.
|
||||
|
@ -838,7 +838,7 @@ static NSString *userAgent = nil;
|
|||
//
|
||||
- (void) _fetchAttachmentsFromMail: (SOGoMailObject *) sourceMail
|
||||
{
|
||||
NSDictionary *currentInfo;
|
||||
NSMutableDictionary *currentInfo;
|
||||
NSArray *attachments;
|
||||
|
||||
unsigned int max, count;
|
||||
|
@ -878,12 +878,12 @@ static NSString *userAgent = nil;
|
|||
|
||||
if (filename)
|
||||
{
|
||||
NSDictionary *currentInfo;
|
||||
NSMutableDictionary *currentInfo;
|
||||
|
||||
currentInfo = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
filename, @"filename",
|
||||
mimeType, @"mimetype",
|
||||
nil];
|
||||
currentInfo = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
filename, @"filename",
|
||||
mimeType, @"mimetype",
|
||||
nil];
|
||||
[self saveAttachment: body
|
||||
withMetadata: currentInfo];
|
||||
}
|
||||
|
@ -1041,8 +1041,7 @@ static NSString *userAgent = nil;
|
|||
{
|
||||
BOOL fromSentMailbox;
|
||||
NGImap4Envelope *sourceEnvelope;
|
||||
NSDictionary *attachment;
|
||||
NSMutableDictionary *info;
|
||||
NSMutableDictionary *attachment, *info;
|
||||
NSString *signature, *nl, *space;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
|
@ -1089,10 +1088,10 @@ static NSString *userAgent = nil;
|
|||
space = (isHTML ? @" " : @" ");
|
||||
[self setText: [NSString stringWithFormat: @"%@%@--%@%@%@", nl, nl, space, nl, signature]];
|
||||
}
|
||||
attachment = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[sourceMail filenameForForward], @"filename",
|
||||
@"message/rfc822", @"mimetype",
|
||||
nil];
|
||||
attachment = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[sourceMail filenameForForward], @"filename",
|
||||
@"message/rfc822", @"mimetype",
|
||||
nil];
|
||||
[self saveAttachment: [sourceMail content]
|
||||
withMetadata: attachment];
|
||||
}
|
||||
|
@ -1170,9 +1169,11 @@ static NSString *userAgent = nil;
|
|||
* file with its mime type.
|
||||
*/
|
||||
- (NSException *) saveAttachment: (NSData *) _attach
|
||||
withMetadata: (NSDictionary *) metadata
|
||||
withMetadata: (NSMutableDictionary *) metadata
|
||||
{
|
||||
NSString *p, *pmime, *name, *mimeType;
|
||||
NSFileManager *fm;
|
||||
NSString *p, *pmime, *name, *baseName, *extension, *mimeType;
|
||||
int i;
|
||||
|
||||
if (![_attach isNotNull])
|
||||
{
|
||||
|
@ -1187,7 +1188,21 @@ static NSString *userAgent = nil;
|
|||
}
|
||||
|
||||
name = [[metadata objectForKey: @"filename"] asSafeFilename];
|
||||
baseName = [name stringByDeletingPathExtension];
|
||||
extension = [name pathExtension];
|
||||
fm = [NSFileManager defaultManager];
|
||||
p = [self pathToAttachmentWithName: name];
|
||||
i = 1;
|
||||
|
||||
while ([fm isReadableFileAtPath: p])
|
||||
{
|
||||
name = [NSString stringWithFormat: @"%@-%x", baseName, i];
|
||||
if ([extension length])
|
||||
name = [NSString stringWithFormat: @"%@.%@", name, extension];
|
||||
p = [self pathToAttachmentWithName: name];
|
||||
[metadata setObject: name forKey: @"filename"];
|
||||
i++;
|
||||
}
|
||||
|
||||
if (![_attach writeToFile: p atomically: YES])
|
||||
{
|
||||
|
@ -2074,7 +2089,7 @@ static NSString *userAgent = nil;
|
|||
if ([[context activeUser] hasEmail: recipient])
|
||||
message = messageForSent = [self mimeMessageForRecipient: nil];
|
||||
else
|
||||
message = [self mimeMessageForRecipient: recipient];;
|
||||
message = [self mimeMessageForRecipient: recipient];
|
||||
|
||||
if (!message)
|
||||
return [NSException exceptionWithHTTPStatus: 500
|
||||
|
|
|
@ -525,10 +525,9 @@ static NSArray *infoKeys = nil;
|
|||
return newFilename;
|
||||
}
|
||||
|
||||
- (NSDictionary *) _scanAttachmentFilenamesInRequest: (id) httpBody
|
||||
- (NSMutableDictionary *) _scanAttachmentFilenamesInRequest: (id) httpBody
|
||||
{
|
||||
NSMutableDictionary *files;
|
||||
NSDictionary *file;
|
||||
NSMutableDictionary *files, *file;
|
||||
NSArray *parts;
|
||||
unsigned int count, max;
|
||||
NGMimeBodyPart *part;
|
||||
|
@ -547,11 +546,11 @@ static NSArray *infoKeys = nil;
|
|||
{
|
||||
mimeType = [(NGMimeType *)[part headerForKey: @"content-type"] stringValue];
|
||||
filename = [self _fixedFilename: [header filename]];
|
||||
file = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
filename, @"filename",
|
||||
mimeType, @"mimetype",
|
||||
[part body], @"body",
|
||||
nil];
|
||||
file = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
filename, @"filename",
|
||||
mimeType, @"mimetype",
|
||||
[part body], @"body",
|
||||
nil];
|
||||
[files setObject: file forKey: [NSString stringWithFormat: @"%@_%@", [header name], filename]];
|
||||
}
|
||||
}
|
||||
|
@ -564,7 +563,8 @@ static NSArray *infoKeys = nil;
|
|||
NSException *error;
|
||||
WORequest *request;
|
||||
NSEnumerator *allAttachments;
|
||||
NSDictionary *attrs, *filenames;
|
||||
NSMutableDictionary *attrs;
|
||||
NSDictionary *filenames;
|
||||
id httpBody;
|
||||
SOGoDraftObject *co;
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@
|
|||
<div class="msg-body">
|
||||
<div layout="row" layout-wrap="layout-wrap">
|
||||
<div class="mailer_mailcontent" layout="row" layout-wrap="layout-wrap"
|
||||
ng-repeat="part in viewer.message.$content() track by $index"
|
||||
ng-repeat="part in viewer.message.$content()"
|
||||
ng-class="::part.msgclass">
|
||||
<div class="md-flex sg-mail-part"
|
||||
tabindex="-1"
|
||||
|
|
|
@ -138,6 +138,7 @@
|
|||
vm.message.$setUID(response.uid);
|
||||
vm.message.$reload();
|
||||
item.inlineUrl = response.lastAttachmentAttrs[0].url;
|
||||
item.file.name = response.lastAttachmentAttrs[0].filename;
|
||||
//console.debug(item); console.debug('success = ' + JSON.stringify(response, undefined, 2));
|
||||
},
|
||||
onCancelItem: function(item, response, status, headers) {
|
||||
|
|
Loading…
Reference in New Issue