Merge pull request #259 from quasipedia/master

Fix for symlink failures
This commit is contained in:
Yeicor
2025-09-28 13:34:27 +02:00
committed by GitHub

View File

@@ -42,8 +42,8 @@ class HTTPHandler(SimpleHTTPRequestHandler):
path = super().translate_path(path)
path = os.path.realpath(path) # Avoid symlink hacks
if self.directory: # Ensure proper subdirectory
base = os.path.abspath(self.directory)
if not os.path.abspath(path).startswith(base):
base = os.path.realpath(self.directory)
if not path.startswith(base):
self.send_error(HTTPStatus.FORBIDDEN, "Path is not in the frontend directory")
return ''
return path