From e31741704f1b93be12fcca2c31f0b8713e148a6d Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Tue, 13 Jul 2021 21:43:37 -0700 Subject: replace dead remote linked media with not found png --- main.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d606674..c3e436f 100644 --- a/main.go +++ b/main.go @@ -2642,7 +2642,18 @@ func RouteImages(w http.ResponseWriter, media string) { resp, err := http.DefaultClient.Do(req) - CheckError(err, "error with Route Images resp") + if err != nil { + fmt.Println("error with Route Images resp " + MediaHashs[media]) + } + + if err != nil || resp.StatusCode == 404 { + fileBytes, err := ioutil.ReadFile("./static/notfound.png") + + CheckError(err, "could not get /static/notfound.png file bytes") + + w.Write(fileBytes) + return + } defer resp.Body.Close() -- cgit v1.2.3