fix empty dir

This commit is contained in:
Mateusz Gruszczyński
2026-06-12 23:31:31 +02:00
parent a2cdc203c2
commit f1129fd3c4
3 changed files with 14 additions and 5 deletions
+4 -1
View File
@@ -356,8 +356,11 @@ def _annotate_path_directories(profile: dict, payload: dict) -> dict:
for item in dirs:
item_path = item.get("path") or ""
has_torrents = _path_has_cached_torrents(int(profile.get("id") or 0), item_path)
is_empty = bool(item.get("empty"))
item["has_torrents"] = has_torrents
item["can_rename"] = bool(item.get("empty")) and not has_torrents
item["can_rename"] = is_empty and not has_torrents
# Note: The picker exposes a short reason so disabled rename buttons explain the safety rule.
item["rename_reason"] = "Rename folder" if item["can_rename"] else ("Folder contains a known torrent path" if has_torrents else "Only empty folders can be renamed")
return payload