Fix repos listing: use depth=2 to list all repo files
This commit is contained in:
@@ -73,9 +73,11 @@ def get_backup_log():
|
||||
"entries": entries[:10]
|
||||
}
|
||||
|
||||
def list_rclone_contents(remote, path=""):
|
||||
def list_rclone_contents(remote, path="", depth=1):
|
||||
"""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:
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
|
||||
if result.returncode == 0:
|
||||
@@ -160,7 +162,7 @@ def list_backups(backup_type):
|
||||
return jsonify({"error": "Unknown type"}), 400
|
||||
|
||||
if backup_type == "repos":
|
||||
items = list_rclone_contents("gdrive", "Git/repos")
|
||||
items = list_rclone_contents("gdrive", "Git/repos", depth=2)
|
||||
elif backup_type == "git":
|
||||
items = list_rclone_contents("gdrive", "Git")
|
||||
items = [i for i in items if "gitea-data" in i.get("Name", "")]
|
||||
|
||||
Reference in New Issue
Block a user