]> Sergey Matveev's repositories - tofuproxy.git/commitdiff
Habr also uses hsto.org domain
authorSergey Matveev <stargrave@stargrave.org>
Wed, 3 Aug 2022 13:56:21 +0000 (16:56 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Wed, 3 Aug 2022 13:56:21 +0000 (16:56 +0300)
rounds/habrImage.go

index f8fb3d34e764c769eb920f6370b63e60b88f9817..7129887c72544698d906a8a4a43f0b461ef74b7a 100644 (file)
@@ -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