From 14666ac6d0b7b26ab29994bd25551c86c3a1c68d Mon Sep 17 00:00:00 2001 From: Patrick Hulce Date: Fri, 8 Nov 2019 10:04:25 -0600 Subject: [PATCH] fix(server): hide failed thumbnails --- .../build-view/audit-detail/simple-details.jsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/server/src/ui/routes/build-view/audit-detail/simple-details.jsx b/packages/server/src/ui/routes/build-view/audit-detail/simple-details.jsx index 380b57757..b2479bcf5 100644 --- a/packages/server/src/ui/routes/build-view/audit-detail/simple-details.jsx +++ b/packages/server/src/ui/routes/build-view/audit-detail/simple-details.jsx @@ -55,7 +55,21 @@ export const SimpleDetails = props => { ); } case 'thumbnail': - return ; + return ( + { + 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 = '';