diff --git a/config.js b/config.js index 14a494d6d..53d63fddd 100644 --- a/config.js +++ b/config.js @@ -40,6 +40,7 @@ const config = { PINNED_URI_2: process.env.PINNED_URI_2, PINNED_LABEL_2: process.env.PINNED_LABEL_2, KNOWN_APP_DOMAINS: process.env.KNOWN_APP_DOMAINS ? process.env.KNOWN_APP_DOMAINS.split(',') : [], + THUMBNAIL_FALLBACK: process.env.THUMBNAIL_FALLBACK, }; config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`; diff --git a/ui/component/fileThumbnail/view.jsx b/ui/component/fileThumbnail/view.jsx index ad818c19c..e5fd1b18e 100644 --- a/ui/component/fileThumbnail/view.jsx +++ b/ui/component/fileThumbnail/view.jsx @@ -2,6 +2,7 @@ import type { Node } from 'react'; import { getThumbnailCdnUrl } from 'util/thumbnail'; import React from 'react'; +import { THUMBNAIL_FALLBACK } from 'config'; import FreezeframeWrapper from './FreezeframeWrapper'; import Placeholder from './placeholder.png'; import classnames from 'classnames'; @@ -14,10 +15,11 @@ type Props = { claim: ?StreamClaim, doResolveUri: string => void, className?: string, + fallbackThumbnail?: string, }; function FileThumbnail(props: Props) { - const { claim, uri, doResolveUri, thumbnail: rawThumbnail, children, allowGifs = false, className } = props; + const { claim, uri, doResolveUri, thumbnail: rawThumbnail, children, allowGifs = false, className, fallbackThumbnail = THUMBNAIL_FALLBACK } = props; const passedThumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://'); const thumbnailFromClaim = uri && claim && claim.value && claim.value.thumbnail ? claim.value.thumbnail.url : undefined; @@ -46,9 +48,11 @@ function FileThumbnail(props: Props) { } // @endif + const cleanUrl = url ? url.replace(/'/g, "\\'") : ''; + return (