safe output path in webui

Former-commit-id: 3c2a992caa45c9121cd1ccac3de9bbcf1a9b058b
This commit is contained in:
hiyouga 2024-05-18 22:42:28 +08:00
parent 7130efff54
commit 02f716907e

View File

@ -37,8 +37,9 @@ DEFAULT_SAVE_DIR = "saves"
USER_CONFIG = "user_config.yaml" USER_CONFIG = "user_config.yaml"
def get_save_dir(*args) -> os.PathLike: def get_save_dir(*paths: str) -> os.PathLike:
return os.path.join(DEFAULT_SAVE_DIR, *args) paths = (path.replace(os.path.sep, "").replace(" ", "").strip() for path in paths)
return os.path.join(DEFAULT_SAVE_DIR, *paths)
def get_config_path() -> os.PathLike: def get_config_path() -> os.PathLike: