Compare commits

...

2 commits

Author SHA1 Message Date
d638dfe38c fixed error handling on wrong symlink directory 2025-06-09 21:34:46 +02:00
9143d783ba fixed symlink dir not being fetched
I can't believe this was the issue...
2025-06-09 21:26:47 +02:00
2 changed files with 11 additions and 1 deletions

View file

@ -1,4 +1,4 @@
PORT = 8000
GRAB_SYMLINKS = true
SYMLINKS_DIR = "symlinks"
SYMLINK_DIR = "symlinks"
STATIC_SHARE_RESTRICTION = true

View file

@ -56,6 +56,8 @@ class CustomHandler(http.server.SimpleHTTPRequestHandler):
project_id = parts[0]
project_dir = get_project_directory(project_id)
if not project_dir:
return os.path.join(BASE_DIR, "404.html")
# Check .staticshare restriction
if STATIC_SHARE_RESTRICTION:
staticshare_path = os.path.join(project_dir, ".staticshare")
@ -88,6 +90,14 @@ class CustomHandler(http.server.SimpleHTTPRequestHandler):
project_dir = get_project_directory(project_id)
if not project_dir:
self.send_response(404)
self.send_header("Content-type", "text/html")
self.end_headers()
with open(os.path.join(BASE_DIR, "404.html"), "rb") as f:
self.wfile.write(f.read())
return
if STATIC_SHARE_RESTRICTION:
staticshare_path = os.path.join(project_dir, ".staticshare")
if not os.path.isfile(staticshare_path):