fix(git-gateway): fix previews for GitHub images not in Large Media (#2125)

This commit is contained in:
Benaiah Mischenko
2019-02-26 13:05:52 -08:00
committed by Shawn Erquhart
parent a6c5ba5722
commit d17f896f47
2 changed files with 8 additions and 6 deletions

View File

@ -215,12 +215,14 @@ export default class GitGateway {
return mediaFiles;
}
const largeMediaURLThunks = await this.getLargeMedia(mediaFiles);
return mediaFiles.map(({ id, url, getDisplayURL, ...rest }) => ({
return mediaFiles.map(({ id, url, urlIsPublicPath, getDisplayURL, ...rest }) => ({
...rest,
id,
url,
urlIsPublicPath: false,
getDisplayURL: largeMediaURLThunks[id] ? largeMediaURLThunks[id] : getDisplayURL,
urlIsPublicPath: largeMediaURLThunks[id] ? false : urlIsPublicPath,
getDisplayURL: largeMediaURLThunks[id]
? largeMediaURLThunks[id]
: getDisplayURL || (url && (() => Promise.resolve(url))),
}));
},
);