Only strip seperators from the end of a path

Otherwise, we might strip the "root" / off Unix pathes
This commit is contained in:
MinchinWeb 2021-10-02 12:32:36 -06:00
commit ac451c300e

View file

@ -92,7 +92,7 @@ class ComplexHTTPRequestHandler(server.SimpleHTTPRequestHandler):
"""Guess at the mime type for the specified file.
"""
# strip trailing slash
path = path.rstrip().strip("/").strip(os.sep)
path = path.rstrip().rstrip("/").rstrip(os.sep)
mimetype = super().guess_type(path)
# If the default guess is too generic, try the python-magic library