diff --git a/app/components/file_attachment_list/file_attachment_image.js b/app/components/file_attachment_list/file_attachment_image.js index 87e42695f..2597b2578 100644 --- a/app/components/file_attachment_list/file_attachment_image.js +++ b/app/components/file_attachment_list/file_attachment_image.js @@ -57,11 +57,16 @@ export default class FileAttachmentImage extends PureComponent { const {file} = props; if (file && file.id) { - const preloadImages = [{uri: Client4.getFileThumbnailUrl(file.id)}]; + const headers = { + Authorization: `Bearer ${Client4.getToken()}`, + 'X-CSRF-Token': Client4.csrf, + 'X-Requested-With': 'XMLHttpRequest', + }; - if (isGif(file)) { - preloadImages.push({uri: Client4.getFileUrl(file.id)}); - } + const preloadImages = [ + {uri: Client4.getFileThumbnailUrl(file.id), headers}, + {uri: Client4.getFileUrl(file.id), headers}, + ]; FastImage.preload(preloadImages); } @@ -94,7 +99,7 @@ export default class FileAttachmentImage extends PureComponent { imageProps.defaultSource = {uri: file.localPath}; } else if (file.id) { imageProps.thumbnailUri = Client4.getFileThumbnailUrl(file.id); - imageProps.imageUri = Client4.getFilePreviewUrl(file.id); + imageProps.imageUri = Client4.getFileUrl(file.id); } return imageProps; }; @@ -149,6 +154,8 @@ export default class FileAttachmentImage extends PureComponent { return this.renderSmallImage(); } + const imageProps = this.imageProps(file); + return ( ); diff --git a/app/components/file_attachment_list/file_attachment_list.js b/app/components/file_attachment_list/file_attachment_list.js index 428625484..dcb70674c 100644 --- a/app/components/file_attachment_list/file_attachment_list.js +++ b/app/components/file_attachment_list/file_attachment_list.js @@ -120,10 +120,8 @@ export default class FileAttachmentList extends PureComponent { let uri; if (file.localPath) { uri = file.localPath; - } else if (isGif(file)) { - uri = Client4.getFileUrl(file.id); } else { - uri = Client4.getFilePreviewUrl(file.id); + uri = Client4.getFileUrl(file.id); } results.push({ diff --git a/app/components/progressive_image/progressive_image.js b/app/components/progressive_image/progressive_image.js index afc40a3bf..7aaecdae1 100644 --- a/app/components/progressive_image/progressive_image.js +++ b/app/components/progressive_image/progressive_image.js @@ -76,8 +76,7 @@ export default class ProgressiveImage extends PureComponent { load = () => { const {imageUri, thumbnailUri} = this.props; - if (thumbnailUri && imageUri) { - FastImage.preload([{uri: imageUri}]); + if (thumbnailUri) { this.setThumbnail(thumbnailUri); } else if (imageUri) { this.setImage(imageUri);