mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
fix: filenot found error
This commit is contained in:
@@ -171,7 +171,11 @@ def restore(body: RestoreBackupBody):
|
|||||||
backups.append(body.backup_dir)
|
backups.append(body.backup_dir)
|
||||||
else:
|
else:
|
||||||
# Restore from all backups
|
# Restore from all backups
|
||||||
|
try:
|
||||||
backup_dirs = [d for d in backup_base_dir.iterdir() if d.is_dir()]
|
backup_dirs = [d for d in backup_base_dir.iterdir() if d.is_dir()]
|
||||||
|
except FileNotFoundError:
|
||||||
|
backup_dirs = []
|
||||||
|
|
||||||
if not backup_dirs:
|
if not backup_dirs:
|
||||||
return {"msg": "No backups found"}, 404
|
return {"msg": "No backups found"}, 404
|
||||||
|
|
||||||
@@ -194,8 +198,12 @@ def list_backups():
|
|||||||
backups = []
|
backups = []
|
||||||
|
|
||||||
entries = []
|
entries = []
|
||||||
for path in backup_dir.iterdir():
|
try:
|
||||||
if path.is_dir():
|
paths = [p for p in backup_dir.iterdir() if p.is_dir()]
|
||||||
|
except FileNotFoundError:
|
||||||
|
paths = []
|
||||||
|
|
||||||
|
for path in paths:
|
||||||
try:
|
try:
|
||||||
entries.append(
|
entries.append(
|
||||||
{"path": path, "timestamp": int(path.name.split(".")[1])}
|
{"path": path, "timestamp": int(path.name.split(".")[1])}
|
||||||
|
|||||||
Reference in New Issue
Block a user