mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-133889: Only show the path of the URL in the SimpleHTTPRequestHandler page (GH-134135)
The query and fragment are ambiguous and not used.
This commit is contained in:
parent
bb32f3c698
commit
5cbc8c632e
3 changed files with 15 additions and 8 deletions
|
@ -818,11 +818,14 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
|
|||
return None
|
||||
list.sort(key=lambda a: a.lower())
|
||||
r = []
|
||||
displaypath = self.path
|
||||
displaypath = displaypath.split('#', 1)[0]
|
||||
displaypath = displaypath.split('?', 1)[0]
|
||||
try:
|
||||
displaypath = urllib.parse.unquote(self.path,
|
||||
displaypath = urllib.parse.unquote(displaypath,
|
||||
errors='surrogatepass')
|
||||
except UnicodeDecodeError:
|
||||
displaypath = urllib.parse.unquote(self.path)
|
||||
displaypath = urllib.parse.unquote(displaypath)
|
||||
displaypath = html.escape(displaypath, quote=False)
|
||||
enc = sys.getfilesystemencoding()
|
||||
title = f'Directory listing for {displaypath}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue