feat: validates config path before loading login info

Adds a check to ensure the provided configuration file path exists and is a valid file before attempting to load login information.
This commit is contained in:
kinoshitakenta 2025-05-28 15:45:01 +08:00
parent e32063e2ce
commit 0671d49497
Signed by: kinoshitakenta
GPG Key ID: A811E8CA36EF425E
1 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,12 @@ def display_usage():
def main(opt):
login_info = LoginInfo(Path(opt.config_path))
config_path = Path(opt.config_path)
if not config_path.exists() or not config_path.is_file():
print(f"Error: Config path '{config_path}' does not exist or is not a file.")
return
login_info = LoginInfo(config_path)
driver = get_driver()
keep_login_status(driver, login_info)