From 675c440cd7a342c25bd37b0f7395dbc4aa01fd20 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 11 Sep 2018 17:28:55 -0400 Subject: [PATCH] MM-12109 Fix handling of return value of getRedirectLocation (#2102) --- .../post_body_additional_content.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/components/post_body_additional_content/post_body_additional_content.js b/app/components/post_body_additional_content/post_body_additional_content.js index 0c0358d1c..0042265d8 100644 --- a/app/components/post_body_additional_content/post_body_additional_content.js +++ b/app/components/post_body_additional_content/post_body_additional_content.js @@ -102,7 +102,13 @@ export default class PostBodyAdditionalContent extends PureComponent { imageUrl = `https://i.ytimg.com/vi/${videoId}/hqdefault.jpg`; ImageCacheManager.cache(null, `https://i.ytimg.com/vi/${videoId}/default.jpg`, () => true); } else { - const shortenedLink = await this.props.actions.getRedirectLocation(link); + const {data} = await this.props.actions.getRedirectLocation(link); + + let shortenedLink; + if (data && data.location) { + shortenedLink = data.location; + } + if (shortenedLink) { if (isImageLink(shortenedLink)) { imageUrl = shortenedLink;