MM-12109 Fix handling of return value of getRedirectLocation (#2102)

This commit is contained in:
Harrison Healey 2018-09-11 17:28:55 -04:00 committed by Elias Nahum
parent 3005a39f07
commit 675c440cd7

View file

@ -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;