From 120e1e4c34eb40ec8b018fde536d5950f4d7e7e6 Mon Sep 17 00:00:00 2001 From: Giom Foret Date: Wed, 22 Mar 2017 17:02:30 +0100 Subject: [PATCH] Bug Fix - Chat screen: image thumbnails management is broken https://github.com/vector-im/riot-ios/issues/1121 The thumbnail url was computed before retrieving the content url. The resulting url was nil. --- MatrixKit/Models/Room/MXKAttachment.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MatrixKit/Models/Room/MXKAttachment.m b/MatrixKit/Models/Room/MXKAttachment.m index 1070007f0..ca58c292c 100644 --- a/MatrixKit/Models/Room/MXKAttachment.m +++ b/MatrixKit/Models/Room/MXKAttachment.m @@ -118,9 +118,6 @@ - (instancetype)initWithEvent:(MXEvent *)mxEvent andMatrixSession:(MXSession*)mx thumbnailFile = _contentInfo[@"thumbnail_file"]; - _thumbnailURL = [self getThumbnailUrlForSize:CGSizeMake(kThumbnailWidth, kThumbnailHeight)]; - _thumbnailMimeType = [self getThumbnailMimeType]; - contentFile = eventContent[@"file"]; // Retrieve the content url by taking into account the potential encryption. @@ -155,6 +152,10 @@ - (instancetype)initWithEvent:(MXEvent *)mxEvent andMatrixSession:(MXSession*)mx } _cacheFilePath = [MXMediaManager cachePathForMediaWithURL:_actualURL andType:mimetype inFolder:_eventRoomId]; + + // Deduce the thumbnail information from the retrieved data. + _thumbnailURL = [self getThumbnailUrlForSize:CGSizeMake(kThumbnailWidth, kThumbnailHeight)]; + _thumbnailMimeType = [self getThumbnailMimeType]; } return self; }