summaryrefslogtreecommitdiffstats
path: root/Lib/SimpleHTTPServer.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2005-12-16 19:36:24 (GMT)
committerGeorg Brandl <georg@python.org>2005-12-16 19:36:24 (GMT)
commita35865fada8bb234e2b7ab61e45a4c62a7d8b054 (patch)
tree7771442d725fe8b5557f567f6d1ae0a76dd47c24 /Lib/SimpleHTTPServer.py
parent84eebf3d2a3671808d44caeb2013be06aa8a15c9 (diff)
downloadcpython-a35865fada8bb234e2b7ab61e45a4c62a7d8b054.zip
cpython-a35865fada8bb234e2b7ab61e45a4c62a7d8b054.tar.gz
cpython-a35865fada8bb234e2b7ab61e45a4c62a7d8b054.tar.bz2
Patch #1360443: Make SimpleHTTPServer display unencoded directory names.
Diffstat (limited to 'Lib/SimpleHTTPServer.py')
-rw-r--r--Lib/SimpleHTTPServer.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/SimpleHTTPServer.py b/Lib/SimpleHTTPServer.py
index 4d8eb77..4b27d17 100644
--- a/Lib/SimpleHTTPServer.py
+++ b/Lib/SimpleHTTPServer.py
@@ -99,8 +99,9 @@ class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
return None
list.sort(key=lambda a: a.lower())
f = StringIO()
- f.write("<title>Directory listing for %s</title>\n" % self.path)
- f.write("<h2>Directory listing for %s</h2>\n" % self.path)
+ displaypath = cgi.escape(urllib.unquote(self.path))
+ f.write("<title>Directory listing for %s</title>\n" % displaypath)
+ f.write("<h2>Directory listing for %s</h2>\n" % displaypath)
f.write("<hr>\n<ul>\n")
for name in list:
fullname = os.path.join(path, name)