fix: restoring site breaks when checking backup version (#26186)
* fix: restoring site breaks when checking backup version The `backup_version` variable exists if and only if the `if match` branch executes, but it is used in a condition in a scope where it may not exist. Changing the variable to `match` leads to correct behaviour. * fix: restoring site breaks when checking backup version Co-authored-by: Akhil Narang <me@akhilnarang.dev> * fix: version check when restoring site should be done from `match` scope * chore: add a `return None` for better readability No functional difference, just easier to understand/read the code. Signed-off-by: Akhil Narang <me@akhilnarang.dev> --------- Signed-off-by: Akhil Narang <me@akhilnarang.dev> Co-authored-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
ff31290d33
commit
05766680f7
1 changed files with 2 additions and 3 deletions
|
|
@ -807,9 +807,8 @@ def get_old_backup_version(sql_file_path: str) -> Version | None:
|
|||
"""
|
||||
header = get_db_dump_header(sql_file_path).split("\n")
|
||||
if match := re.search(r"Frappe (\d+\.\d+\.\d+)", header[0]):
|
||||
backup_version = match[1]
|
||||
|
||||
return Version(backup_version) if backup_version else None
|
||||
return Version(match[1])
|
||||
return None
|
||||
|
||||
|
||||
def get_backup_version(sql_file_path: str) -> Version | None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue