Add object detection, tracking, mobile notifications, and search to any security camera.
only serve files inside cameras
Rory Clearcf3909f8a622
diff --git a/clearcam.py b/clearcam.pyindex a1e4403..c29df5e 100644--- a/clearcam.py+++ b/clearcam.py@@ -18,7 +18,6 @@ from datetime import datetime, time as time_objimport uuidimport urllibfrom urllib.parse import urlparse, parse_qs-from pathlib import Pathimport structfrom urllib.parse import unquote, quoteimport zlib@@ -1014,6 +1013,14 @@ class HLSRequestHandler(BaseHTTPRequestHandler):passfile_path = BASE_DIR / "cameras" / requested_path+ try: file_path = ((BASE_DIR / "cameras").resolve() / requested_path).resolve()+ except (OSError, RuntimeError):+ self.send_error(404)+ return+ try: _ = file_path.relative_to((BASE_DIR / "cameras").resolve())+ except:+ self.send_error(404)+ returnif not file_path.exists():self.send_error(404)