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; return mediaFiles;
} }
const largeMediaURLThunks = await this.getLargeMedia(mediaFiles); const largeMediaURLThunks = await this.getLargeMedia(mediaFiles);
return mediaFiles.map(({ id, url, getDisplayURL, ...rest }) => ({ return mediaFiles.map(({ id, url, urlIsPublicPath, getDisplayURL, ...rest }) => ({
...rest, ...rest,
id, id,
url, url,
urlIsPublicPath: false, urlIsPublicPath: largeMediaURLThunks[id] ? false : urlIsPublicPath,
getDisplayURL: largeMediaURLThunks[id] ? largeMediaURLThunks[id] : getDisplayURL, getDisplayURL: largeMediaURLThunks[id]
? largeMediaURLThunks[id]
: getDisplayURL || (url && (() => Promise.resolve(url))),
})); }));
}, },
); );

View File

@ -6,13 +6,13 @@ weight: 10
[Netlify Large Media](https://www.netlify.com/features/large-media/) is a [Git LFS](https://git-lfs.github.com/) implementation for repositories connected to Netlify sites. This means that you can use Git to work with large asset files like images, audio, and video, without bloating your repository. It does this by replacing the asset files in your repository with text pointer files, then uploading the assets to the Neltify Large Media storage service. [Netlify Large Media](https://www.netlify.com/features/large-media/) is a [Git LFS](https://git-lfs.github.com/) implementation for repositories connected to Netlify sites. This means that you can use Git to work with large asset files like images, audio, and video, without bloating your repository. It does this by replacing the asset files in your repository with text pointer files, then uploading the assets to the Neltify Large Media storage service.
If you have a Netlify site with Large Media enabled, Netlify CMS (version 2.5.0 and above) will handle Large Media asset files seamlessly, in the same way as files stored directly in the repository. If you have a Netlify site with Large Media enabled, Netlify CMS (version 2.5.1 and above) will handle Large Media asset files seamlessly, in the same way as files stored directly in the repository.
## Requirements ## Requirements
To use Netlify Large Media with Netlify CMS, you will need to do the following: To use Netlify Large Media with Netlify CMS, you will need to do the following:
- [Upgrade Netlify CMS](/docs/update-the-cms-version/) to version 2.5.0 or above - [Upgrade Netlify CMS](/docs/update-the-cms-version/) to version 2.5.1 or above.
- Configure Netlify CMS to use the [Git Gateway backend with Netlify Identity](/docs/authentication-backends/#git-gateway-with-netlify-identity). - Configure Netlify CMS to use the [Git Gateway backend with Netlify Identity](/docs/authentication-backends/#git-gateway-with-netlify-identity).
- Configure the Netlify site and connected repository to use Large Media, following the [Large Media docs on Netlify](https://www.netlify.com/docs/large-media/). - Configure the Netlify site and connected repository to use Large Media, following the [Large Media docs on Netlify](https://www.netlify.com/docs/large-media/).