Fix path decoding.

This commit is contained in:
Sergio Martínez Portela 2023-09-27 23:30:26 +02:00
parent 00cb3fa203
commit 6d78ad53c6

View File

@ -8,6 +8,8 @@ import os
import time import time
import select import select
import urllib.parse
import inotify.adapters import inotify.adapters
PORT = int(os.getenv('PORT', 8000)) PORT = int(os.getenv('PORT', 8000))
@ -55,7 +57,7 @@ class Server(http.server.SimpleHTTPRequestHandler):
time.sleep(SLEEP_TIME) time.sleep(SLEEP_TIME)
return return
path = self.path path = urllib.parse.unquote(self.path)
if path.strip('/') == '': if path.strip('/') == '':
path = '/index.html' path = '/index.html'
if os.path.isdir(path.strip('/')): if os.path.isdir(path.strip('/')):