File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -90,14 +90,16 @@ def response_path(path):
9090 """
9191 home_path = os .getcwd () + "/webroot" + path
9292
93+ # URI is a directory, then return plain-text listing of the contents and mime_type
9394 if os .path .isdir (home_path ):
94- mime_type = b"text/plain"
9595 content = ('\r \n , ' .join (os .listdir (home_path ))).encode ('utf8' )
96+ mime_type = b"text/plain"
9697
98+ # URI is a file, then return contents of file and mime_type
9799 elif os .path .isfile (home_path ):
98- mime_type = mimetypes .guess_type (path )[0 ].encode ('utf8' )
99100 with open (home_path , 'rb' ) as file :
100101 content = file .read ()
102+ mime_type = mimetypes .guess_type (path )[0 ].encode ('utf8' )
101103
102104 # Raise a NameError if the requested content is not present under webroot.
103105 else :
You can’t perform that action at this time.
0 commit comments