File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414import http .server
1515import traceback
1616from typing import Mapping
17+ import urllib .parse
1718import warnings
1819import webbrowser
1920
@@ -60,6 +61,7 @@ def handle_request(self) -> str:
6061 return "Not Found: Please normalize all module separators to '/'."
6162 else :
6263 module_name = path .lstrip ("/" ).removesuffix (".html" ).replace ("/" , "." )
64+ module_name = urllib .parse .unquote (module_name )
6365 if module_name not in self .server .all_modules :
6466 self .send_response (404 )
6567 self .send_header ("content-type" , "text/html" )
Original file line number Diff line number Diff line change @@ -69,6 +69,11 @@ def test_get_module():
6969 )
7070
7171
72+ def test_get_module_url_escape_sequences ():
73+ assert b"make_dataclass" in handle_request (
74+ b"GET /%64atac%6Ca%73se%73.html HTTP/1.1\r \n \r \n "
75+ )
76+
7277def test_get_dependency ():
7378 assert b"a template engine written in pure Python" in handle_request (
7479 b"GET /jinja2.html HTTP/1.1\r \n \r \n "
You can’t perform that action at this time.
0 commit comments