diff --git a/src/backends/github/implementation.js b/src/backends/github/implementation.js index eb3b865d62df..f357b6c82ff9 100644 --- a/src/backends/github/implementation.js +++ b/src/backends/github/implementation.js @@ -94,7 +94,11 @@ export default class GitHub { return this.api.listFiles(this.config.get('media_folder')) .then(files => files.filter(file => file.type === 'file')) .then(files => files.map(({ sha, name, size, download_url, path }) => { - return { id: sha, name, size, url: download_url, path }; + const url = new URL(download_url); + if (url.pathname.match(/.svg$/)) { + url.search += (url.search.slice(1) === '' ? '?' : '&') + 'sanitize=true'; + } + return { id: sha, name, size, url: url.href, path }; })); } diff --git a/src/components/MediaLibrary/MediaLibrary.js b/src/components/MediaLibrary/MediaLibrary.js index b20611cc52fb..0eff29da7980 100644 --- a/src/components/MediaLibrary/MediaLibrary.js +++ b/src/components/MediaLibrary/MediaLibrary.js @@ -21,8 +21,8 @@ import { Icon } from 'UI'; * Extensions used to determine which files to show when the media library is * accessed from an image insertion field. */ -const IMAGE_EXTENSIONS_VIEWABLE = [ 'jpg', 'jpeg', 'webp', 'gif', 'png', 'bmp', 'tiff' ]; -const IMAGE_EXTENSIONS = [ ...IMAGE_EXTENSIONS_VIEWABLE, 'svg' ]; +const IMAGE_EXTENSIONS_VIEWABLE = [ 'jpg', 'jpeg', 'webp', 'gif', 'png', 'bmp', 'tiff', 'svg' ]; +const IMAGE_EXTENSIONS = [ ...IMAGE_EXTENSIONS_VIEWABLE ]; class MediaLibrary extends React.Component {