mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-19 14:14:13 +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 = super().translate_path(path)
|
||||||
path = os.path.realpath(path) # Avoid symlink hacks
|
path = os.path.realpath(path) # Avoid symlink hacks
|
||||||
if self.directory: # Ensure proper subdirectory
|
if self.directory: # Ensure proper subdirectory
|
||||||
base = os.path.abspath(self.directory)
|
base = os.path.realpath(self.directory)
|
||||||
if not os.path.abspath(path).startswith(base):
|
if not path.startswith(base):
|
||||||
self.send_error(HTTPStatus.FORBIDDEN, "Path is not in the frontend directory")
|
self.send_error(HTTPStatus.FORBIDDEN, "Path is not in the frontend directory")
|
||||||
return ''
|
return ''
|
||||||
return path
|
return path
|
||||||
|
|||||||
Reference in New Issue
Block a user