diff options
author | FChannel <> | 2021-07-13 21:43:37 -0700 |
---|---|---|
committer | FChannel <> | 2021-07-13 21:43:37 -0700 |
commit | e31741704f1b93be12fcca2c31f0b8713e148a6d (patch) | |
tree | 7a515f02d5c12c1e282eef37a41cc7d6249b3464 /main.go | |
parent | 4abf08a7d49abb381bb4a5771af73a8ca34851e1 (diff) |
replace dead remote linked media with not found png
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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() |