From 371f2d895fb9b4e5b0b8316672e9c5b47139a446 Mon Sep 17 00:00:00 2001
From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu>
Date: Tue, 18 Aug 2020 22:04:08 -0500
Subject: [PATCH] Clear broken images when doesn't exist

---
 layouts/custom/repository.html | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/layouts/custom/repository.html b/layouts/custom/repository.html
index d735aec..84d19fc 100644
--- a/layouts/custom/repository.html
+++ b/layouts/custom/repository.html
@@ -860,10 +860,16 @@
                     thm_pr.src = "https://s3.us-east-2.amazonaws.com/biorepo.images.thumbnails/Pr/" + repo[i]["Disease Status"] + ("000"+repo[i]["Study ID"]).slice(-3) + ".00.Pr.jpg"
                     thm_pr.height = "75"
                     row_he_pr.appendChild(thm_pr)
+                    thm_pr.onerror=function(){
+                        this.remove()
+                    }
                     var thm_bl = document.createElement("img")
                     thm_bl.src = "https://s3.us-east-2.amazonaws.com/biorepo.images.thumbnails/Bl/" + repo[i]["Disease Status"] + ("000"+repo[i]["Study ID"]).slice(-3) + ".00.Bl.jpg"
                     thm_bl.height = "75"
                     row_he_bl.appendChild(thm_bl)
+                    thm_bl.onerror=function(){
+                        this.remove()
+                    }
                     row_ds.innerHTML = repo[i]["Disease Status"]
                     row_si.innerHTML = repo[i]["Study ID"]
                     row_ag.innerHTML = repo[i].Age
-- 
GitLab