File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1919
2020from Components .config import config
2121from Tools .Directories import fileExists
22+ from utilities import lenient_force_utf_8 , sanitise_filename_slashes
23+
2224
2325def new_getRequestHostname (self ):
2426 host = self .getHeader (b'host' )
@@ -38,8 +40,8 @@ def render(self, request):
3840 action = request .args ["action" ][0 ]
3941
4042 if "file" in request .args :
41- filename = request .args ["file" ][0 ]. decode ( 'utf-8' , 'ignore' ). encode ( 'utf-8' )
42- filename = re . sub ( "^/+" , "/" , os .path .realpath (filename ))
43+ filename = lenient_force_utf_8 ( request .args ["file" ][0 ])
44+ filename = sanitise_filename_slashes ( os .path .realpath (filename ))
4345
4446 if not os .path .exists (filename ):
4547 return "File '%s' not found" % (filename )
Original file line number Diff line number Diff line change 4343import twisted .web .static
4444from twisted .web import http
4545
46+ from utilities import MANY_SLASHES_REGEX
4647import file
4748
48- MANY_SLASHES_PATTERN = r'[\/]+'
49- MANY_SLASHES_REGEX = re .compile (MANY_SLASHES_PATTERN )
50-
5149#: default path from which files will be served
5250DEFAULT_ROOT_PATH = os .path .abspath (os .path .dirname (__file__ ))
5351
File renamed without changes.
You can’t perform that action at this time.
0 commit comments