diff Lib/SimpleHTTPServer.py @ 36048:dee253a3116c 2.4

Patch #1360443: Make SimpleHTTPServer display unencoded directory names.
author Georg Brandl <georg@python.org>
date Fri, 16 Dec 2005 19:36:24 +0000
parents 18cff3ed74d3
children da0995ca1f30
line wrap: on
line diff
--- a/Lib/SimpleHTTPServer.py	Fri Dec 16 19:23:45 2005 +0000
+++ b/Lib/SimpleHTTPServer.py	Fri Dec 16 19:36:24 2005 +0000
@@ -99,8 +99,9 @@
             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)