Fix repos listing: use depth=2 to list all repo files

This commit is contained in:
2026-06-22 18:36:18 +00:00
parent 394cc4d15e
commit 843bd5f2dc
+5 -3
View File
@@ -73,9 +73,11 @@ def get_backup_log():
"entries": entries[:10] "entries": entries[:10]
} }
def list_rclone_contents(remote, path=""): def list_rclone_contents(remote, path="", depth=1):
"""List contents of a rclone remote path.""" """List contents of a rclone remote path."""
cmd = ["rclone", "lsjson", f"{remote}:{path}", "--drive-root-folder-id", "1ey-5aABgHDtirxeJarWy0ZmeqQPVTYtm"] cmd = ["rclone", "lsjson", f"{remote}:{path}",
"--drive-root-folder-id", "1ey-5aABgHDtirxeJarWy0ZmeqQPVTYtm",
"--max-depth", str(depth)]
try: try:
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30) result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
if result.returncode == 0: if result.returncode == 0:
@@ -160,7 +162,7 @@ def list_backups(backup_type):
return jsonify({"error": "Unknown type"}), 400 return jsonify({"error": "Unknown type"}), 400
if backup_type == "repos": if backup_type == "repos":
items = list_rclone_contents("gdrive", "Git/repos") items = list_rclone_contents("gdrive", "Git/repos", depth=2)
elif backup_type == "git": elif backup_type == "git":
items = list_rclone_contents("gdrive", "Git") items = list_rclone_contents("gdrive", "Git")
items = [i for i in items if "gitea-data" in i.get("Name", "")] items = [i for i in items if "gitea-data" in i.get("Name", "")]