From d17f896f479292db06d3a4b39f2e51b6c41101bd Mon Sep 17 00:00:00 2001 From: Benaiah Mischenko Date: Tue, 26 Feb 2019 13:05:52 -0800 Subject: [PATCH] fix(git-gateway): fix previews for GitHub images not in Large Media (#2125) --- .../netlify-cms-backend-git-gateway/src/implementation.js | 8 +++++--- website/content/docs/netlify-large-media.md | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/netlify-cms-backend-git-gateway/src/implementation.js b/packages/netlify-cms-backend-git-gateway/src/implementation.js index bd691f76..e1d0d770 100644 --- a/packages/netlify-cms-backend-git-gateway/src/implementation.js +++ b/packages/netlify-cms-backend-git-gateway/src/implementation.js @@ -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))), })); }, ); diff --git a/website/content/docs/netlify-large-media.md b/website/content/docs/netlify-large-media.md index 72b0d344..f82b850b 100644 --- a/website/content/docs/netlify-large-media.md +++ b/website/content/docs/netlify-large-media.md @@ -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. -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 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 the Netlify site and connected repository to use Large Media, following the [Large Media docs on Netlify](https://www.netlify.com/docs/large-media/). @@ -35,4 +35,4 @@ backend: name: git-gateway ## Set to false to prevent transforming images in media gallery view use_large_media_transforms_in_media_library: false -``` \ No newline at end of file +```