From: Sergey Matveev Date: Wed, 3 Aug 2022 13:56:21 +0000 (+0300) Subject: Habr also uses hsto.org domain X-Git-Tag: v0.1.0~21 X-Git-Url: http://www.git.stargrave.org/?p=tofuproxy.git;a=commitdiff_plain;h=fd9448f13222004e3c2f59f53a318b08e259db7b Habr also uses hsto.org domain --- diff --git a/rounds/habrImage.go b/rounds/habrImage.go index f8fb3d3..7129887 100644 --- a/rounds/habrImage.go +++ b/rounds/habrImage.go @@ -29,7 +29,8 @@ func RoundHabrImage( w http.ResponseWriter, req *http.Request, ) (bool, error) { - if host == "habrastorage.org" && strings.Contains(req.URL.Path, "r/w780q1/") { + if ((host == "habrastorage.org") || (host == "hsto.org")) && + strings.Contains(req.URL.Path, "r/w780q1/") { req.URL.Path = strings.Replace(req.URL.Path, "r/w780q1/", "", 1) http.Redirect(w, req, req.URL.String(), http.StatusFound) return false, nil