Revert "Use fallback image for broken thumbnails"

This reverts commit 6aae5987e6.
This commit is contained in:
Sean Yesmunt 2021-02-18 02:13:54 -05:00
parent 9442d586ee
commit 647d2f74df
2 changed files with 2 additions and 7 deletions

View file

@ -41,7 +41,6 @@ const config = {
PINNED_URI_2: process.env.PINNED_URI_2, PINNED_URI_2: process.env.PINNED_URI_2,
PINNED_LABEL_2: process.env.PINNED_LABEL_2, PINNED_LABEL_2: process.env.PINNED_LABEL_2,
KNOWN_APP_DOMAINS: process.env.KNOWN_APP_DOMAINS ? process.env.KNOWN_APP_DOMAINS.split(',') : [], 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}`; config.URL_LOCAL = `http://localhost:${config.WEB_SERVER_PORT}`;

View file

@ -2,7 +2,6 @@
import type { Node } from 'react'; import type { Node } from 'react';
import { getThumbnailCdnUrl } from 'util/thumbnail'; import { getThumbnailCdnUrl } from 'util/thumbnail';
import React from 'react'; import React from 'react';
import { THUMBNAIL_FALLBACK } from 'config';
import FreezeframeWrapper from './FreezeframeWrapper'; import FreezeframeWrapper from './FreezeframeWrapper';
import Placeholder from './placeholder.png'; import Placeholder from './placeholder.png';
import classnames from 'classnames'; import classnames from 'classnames';
@ -15,11 +14,10 @@ type Props = {
claim: ?StreamClaim, claim: ?StreamClaim,
doResolveUri: string => void, doResolveUri: string => void,
className?: string, className?: string,
fallbackThumbnail?: string,
}; };
function FileThumbnail(props: Props) { function FileThumbnail(props: Props) {
const { claim, uri, doResolveUri, thumbnail: rawThumbnail, children, allowGifs = false, className, fallbackThumbnail = THUMBNAIL_FALLBACK } = props; const { claim, uri, doResolveUri, thumbnail: rawThumbnail, children, allowGifs = false, className } = props;
const passedThumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://'); const passedThumbnail = rawThumbnail && rawThumbnail.trim().replace(/^http:\/\//i, 'https://');
const thumbnailFromClaim = const thumbnailFromClaim =
uri && claim && claim.value && claim.value.thumbnail ? claim.value.thumbnail.url : undefined; uri && claim && claim.value && claim.value.thumbnail ? claim.value.thumbnail.url : undefined;
@ -48,11 +46,9 @@ function FileThumbnail(props: Props) {
} }
// @endif // @endif
const cleanUrl = url ? url.replace(/'/g, "\\'") : '';
return ( return (
<div <div
style={{ backgroundImage: `url('${cleanUrl}'), url('${fallbackThumbnail}')` }} style={{ backgroundImage: `url('${url ? url.replace(/'/g, "\\'") : ''}')` }}
className={classnames('media__thumb', className, { className={classnames('media__thumb', className, {
'media__thumb--resolving': !hasResolvedClaim, 'media__thumb--resolving': !hasResolvedClaim,
})} })}