From 2acb4d9f4eac5033eb997a35f75c9be93934b062 Mon Sep 17 00:00:00 2001 From: Alihan Date: Sun, 12 Oct 2025 23:47:15 +0300 Subject: [PATCH] Fix compression for files in root directory - Handle __root__ special case in compression start endpoint - Allow compression of videos not organized in date folders --- backend/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/main.py b/backend/main.py index d35afe6..0f449c1 100644 --- a/backend/main.py +++ b/backend/main.py @@ -364,7 +364,11 @@ async def start_compression(request: CompressionRequest): if not 1 <= request.reduce_percentage <= 90: raise HTTPException(status_code=400, detail="Percentage must be between 1-90") - file_path = FOOTAGES_PATH / request.location / request.date / request.filename + # Handle __root__ case (files not in date subdirectories) + if request.date == "__root__": + file_path = FOOTAGES_PATH / request.location / request.filename + else: + file_path = FOOTAGES_PATH / request.location / request.date / request.filename if not file_path.exists(): raise HTTPException(status_code=404, detail="File not found")