mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-19 22:24:17 +01:00
Fix fro symlink failures
Issue outlined in https://github.com/yeicor-3d/yet-another-cad-viewer/issues/258
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user