summaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py3/twisted/web/_template_util.py
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2024-08-25 12:54:32 +0300
committerrobot-piglet <[email protected]>2024-08-25 13:03:33 +0300
commit4a64a813e1d34e732f35d8a65147974f76395a6f (patch)
treea8da0dede5213f85e45b95047cfbdcf5427cf0b7 /contrib/python/Twisted/py3/twisted/web/_template_util.py
parente9bbee265681b79a9ef9795bdc84cf6996f9cfec (diff)
Intermediate changes
Diffstat (limited to 'contrib/python/Twisted/py3/twisted/web/_template_util.py')
-rw-r--r--contrib/python/Twisted/py3/twisted/web/_template_util.py30
1 files changed, 1 insertions, 29 deletions
diff --git a/contrib/python/Twisted/py3/twisted/web/_template_util.py b/contrib/python/Twisted/py3/twisted/web/_template_util.py
index 230c33f3e8f..501941ad121 100644
--- a/contrib/python/Twisted/py3/twisted/web/_template_util.py
+++ b/contrib/python/Twisted/py3/twisted/web/_template_util.py
@@ -92,7 +92,7 @@ def redirectTo(URL: bytes, request: IRequest) -> bytes:
</body>
</html>
""" % {
- b"url": URL
+ b"url": escape(URL.decode("utf-8")).encode("utf-8")
}
return content
@@ -118,34 +118,6 @@ class Redirect(resource.Resource):
return self
-# FIXME: This is totally broken, see https://twistedmatrix.com/trac/ticket/9838
-class ChildRedirector(Redirect):
- isLeaf = False
-
- def __init__(self, url):
- # XXX is this enough?
- if (
- (url.find("://") == -1)
- and (not url.startswith(".."))
- and (not url.startswith("/"))
- ):
- raise ValueError(
- (
- "It seems you've given me a redirect (%s) that is a child of"
- " myself! That's not good, it'll cause an infinite redirect."
- )
- % url
- )
- Redirect.__init__(self, url)
-
- def getChild(self, name, request):
- newUrl = self.url
- if not newUrl.endswith("/"):
- newUrl += "/"
- newUrl += name
- return ChildRedirector(newUrl)
-
-
class ParentRedirect(resource.Resource):
"""
Redirect to the nearest directory and strip any query string.