From a030a832072de780319d600f9096cbfef37585ff Mon Sep 17 00:00:00 2001 From: Claus Lohmar Date: Mon, 27 Jul 2026 07:41:10 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20session=20scanner=20now=20walks=20in/=20?= =?UTF-8?q?recursively=20=E2=80=94=20finds=20files=20inside=20extracted=20?= =?UTF-8?q?subdirectories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/backend/app.py b/backend/app.py index a70ac4a..2774c8f 100644 --- a/backend/app.py +++ b/backend/app.py @@ -154,21 +154,19 @@ def list_sessions(): session_files = [] total_bytes = 0 has_disks = False - for f in sorted(in_dir.iterdir()): - if f.is_file(): - sz = f.stat().st_size - session_files.append({"name": f.name, "size_bytes": sz, "size_gb": round(sz / (1024**3), 1)}) - total_bytes += sz - elif f.is_dir(): - for df in f.rglob("*"): - if df.is_file() and df.suffix.lower() in {".vmdk", ".qcow2", ".img", ".raw", ".vhd", ".vhdx"}: - has_disks = True - break + all_files = sorted([f for f in in_dir.rglob("*") if f.is_file()], key=lambda f: f.stat().st_size, reverse=True) + for f in all_files: + sz = f.stat().st_size + total_bytes += sz + rel = str(f.relative_to(in_dir)) + session_files.append({"name": rel, "size_bytes": sz, "size_gb": round(sz / (1024**3), 1)}) + if f.suffix.lower() in {".vmdk", ".qcow2", ".img", ".raw", ".vhd", ".vhdx"}: + has_disks = True if not session_files: continue sessions.append({ "session_id": entry.name, - "files": session_files, + "files": session_files[:10], "total_size_gb": round(total_bytes / (1024**3), 1), "has_disks": has_disks, })