8000 Patch #1360443: Make SimpleHTTPServer display unencoded directory names. · python/cpython@6ee6952 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ee6952

Browse files
committed
Patch #1360443: Make SimpleHTTPServer display unencoded directory names.
< 8000 svg aria-hidden="true" focusable="false" class="octicon octicon-git-branch Octicon-sc-9kayk9-0 mr-1" viewBox="0 0 16 16" width="16" height="16" fill="currentColor" display="inline-block" overflow="visible" style="vertical-align:text-bottom">
1 parent 08caadc commit 6ee6952

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/SimpleHTTPServer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ def list_directory(self, path):
103103
return None
104104
list.sort(key=lambda a: < 7B09 span class=pl-s1>a.lower())
105105
f = StringIO()
106-
f.write("<title>Directory listing for %s</title>\n" % self.path)
107-
f.write("<h2>Directory listing for %s</h2>\n" % self.path)
106+
displaypath = cgi.escape(urllib.unquote(self.path))
107+
f.write("<title>Directory listing for %s</title>\n" % displaypath)
108+
f.write("<h2>Directory listing for %s</h2>\n" % displaypath)
108109
f.write("<hr>\n<ul>\n")
109110
for name in list:
110111
fullname = os.path.join(path, name)

0 commit comments

Comments
 (0)
0