show Local Backup Not Found

This commit is contained in:
rambros 2026-03-22 21:53:25 +05:30
parent 185afb1ee0
commit 694ee1d67a
2 changed files with 10 additions and 16 deletions

View file

@ -68,25 +68,16 @@ class MigrationContext:
if d.is_dir(): if d.is_dir():
dname = d.name.upper() dname = d.name.upper()
if "DISCORD_BACKUP" in dname and dname.endswith(f"-{sid_str}"): if "DISCORD_BACKUP" in dname and dname.endswith(f"-{sid_str}"):
logger.info(f"Found backup directory: {d}") logger.info(f"Found backup directory in workspace: {d}")
return d return d
# 2. Fallback to global search if it wasn't found in the workspace # If not found in the workspace, return the expected location inside the workspace
# We use a pattern that matches the name directly to be faster than rglob("*") # This allows validation screens to correctly report "not found" or "invalid"
pattern = f"DISCORD_BACKUP-{sid_str}"
for d in Path(".").rglob(pattern):
if d.is_dir():
logger.info(f"Found backup directory globally: {d}")
return d
# 3. Last ditch: some backups might not have the DISCORD_BACKUP prefix in some forks/versions?
# Unlikely here, so we stick to the return
# If not found anywhere, return the expected location inside the workspace
new_path = base_dir / f"DISCORD_BACKUP-{sid_str}" new_path = base_dir / f"DISCORD_BACKUP-{sid_str}"
logger.info(f"Using lazy backup path: {new_path}") logger.info(f"Using lazy backup path (not yet existing): {new_path}")
return new_path return new_path
async def validate_all(self) -> Dict[str, Any]: async def validate_all(self) -> Dict[str, Any]:
"""Returns connection validation status as a dictionary.""" """Returns connection validation status as a dictionary."""
try: try:

View file

@ -295,11 +295,14 @@ class OperationPane(Container):
d_status = "[red]SERVER NOT SET[/red]" d_status = "[red]SERVER NOT SET[/red]"
elif v.get("discord_timeout"): elif v.get("discord_timeout"):
d_status = "[red]TIMEOUT[/red]" d_status = "[red]TIMEOUT[/red]"
if d_err: elif d_err:
d_status = f"[red]{d_err}[/red]" d_status = f"[red]{d_err}[/red]"
elif d_missing: elif d_missing:
d_status = f"[yellow]MISSING: {', '.join(d_missing)}[/yellow]" d_status = f"[yellow]MISSING: {', '.join(d_missing)}[/yellow]"
elif v.get("discord_token") is False: elif v.get("discord_token") is False:
if self.config.tool_mode == "backup_transfer" and self.view_mode == "shuttle":
d_status = "[yellow]Local Backup[/yellow] [red]Not Found[/red]"
else:
d_status = "[red]INVALID[/red]" d_status = "[red]INVALID[/red]"
else: else:
d_status = "" d_status = ""