[Python-checkins] commit of r41715 - python/branches/release24-maint/Lib/SimpleHTTPServer.py

reinhold.birkenfeld python-checkins at python.org
Fri Dec 16 20:36:24 CET 2005


Author: reinhold.birkenfeld
Date: Fri Dec 16 20:36:24 2005
New Revision: 41715

Modified:
   python/branches/release24-maint/Lib/SimpleHTTPServer.py
Log:
Patch #1360443: Make SimpleHTTPServer display unencoded directory names.



Modified: python/branches/release24-maint/Lib/SimpleHTTPServer.py
==============================================================================
--- python/branches/release24-maint/Lib/SimpleHTTPServer.py	(original)
+++ python/branches/release24-maint/Lib/SimpleHTTPServer.py	Fri Dec 16 20:36:24 2005
@@ -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)


More information about the Python-checkins mailing list