mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-20 00:24:43 +02:00
Manage bad m.file attachment format
https://github.com/vector-im/element-ios/issues/7406 By using value type checker methods. With this fix, attachments with a wrong size format are still displayed in the timeline. Only the size is omitted
This commit is contained in:
@@ -1362,14 +1362,21 @@ static NSString *const kRepliedTextPattern = @"<mx-reply>.*<blockquote>.*<br>(.*
|
||||
{
|
||||
body = body? body : [VectorL10n noticeFileAttachment];
|
||||
|
||||
NSDictionary *fileInfo = contentToUse[@"info"];
|
||||
NSDictionary *fileInfo;
|
||||
MXJSONModelSetDictionary(fileInfo, contentToUse[@"info"]);
|
||||
if (fileInfo)
|
||||
{
|
||||
NSNumber *fileSize = fileInfo[@"size"];
|
||||
NSNumber *fileSize;
|
||||
MXJSONModelSetNumber(fileSize, fileInfo[@"size"])
|
||||
if (fileSize)
|
||||
{
|
||||
body = [NSString stringWithFormat:@"%@ (%@)", body, [MXTools fileSizeToString: fileSize.longValue]];
|
||||
}
|
||||
else
|
||||
{
|
||||
MXLogDebug(@"[MXKEventFormatter] Warning: Unsupported m.file format: %@", event.description);
|
||||
*error = MXKEventFormatterErrorUnsupported;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user