reroute memes to donks in emergencies
Ted Unangst tedu@tedunangst.com
Sun, 22 Oct 2023 15:07:44 -0400
2 files changed,
9 insertions(+),
1 deletions(-)
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,8 @@ changelog
### next ++ Reroute memes to donks in emergencies. + + Fix handling of svg with bom fucks. + FastCGI listening.
M
web.go
→
web.go
@@ -2423,7 +2423,13 @@ func servememe(w http.ResponseWriter, r *http.Request) {
meme := mux.Vars(r)["meme"] w.Header().Set("Cache-Control", "max-age="+somedays()) - http.ServeFile(w, r, dataDir+"/memes/"+meme) + _, err := os.Stat(dataDir + "/memes/" + meme) + if err == nil { + http.ServeFile(w, r, dataDir+"/memes/"+meme) + } else { + mux.Vars(r)["xid"] = meme + servefile(w, r) + } } func servefile(w http.ResponseWriter, r *http.Request) {