Skip to content

Commit

Permalink
fix(server): hide failed thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Nov 8, 2019
1 parent c7934e6 commit 14666ac
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,21 @@ export const SimpleDetails = props => {
);
}
case 'thumbnail':
return <img style={{width: 48, height: 48, objectFit: 'cover'}} src={value} />;
return (
<img
style={{width: 48, height: 48, objectFit: 'cover'}}
src={'asdfasjdfoiasjdfosdj'}
onError={evt => {
const img = evt.srcElement;
if (!(img instanceof HTMLImageElement)) return;

// On failure just replace the image with a 1x1 transparent gif.
img.onerror = null;
img.src =
'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
}}
/>
);
case 'url': {
let display = value;
let hostname = '';
Expand Down

0 comments on commit 14666ac

Please sign in to comment.