aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFChannel <>2021-07-13 21:43:37 -0700
committerFChannel <>2021-07-13 21:43:37 -0700
commite31741704f1b93be12fcca2c31f0b8713e148a6d (patch)
tree7a515f02d5c12c1e282eef37a41cc7d6249b3464
parent4abf08a7d49abb381bb4a5771af73a8ca34851e1 (diff)
replace dead remote linked media with not found png
-rw-r--r--main.go13
1 files changed, 12 insertions, 1 deletions
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()