diff options
author | timntorres <timothynarcisotorres@gmail.com> | 2022-10-21 09:11:12 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-21 13:52:24 +0000 |
commit | 51e3dc9ccad157d7161b697a246e26c868d46a7c (patch) | |
tree | d3dd6679b0dbde70dd9586abc6c50b90498efaa3 | |
parent | 3e12b5295c91f18ca1c89526f4276cb2a348400c (diff) | |
download | stable-diffusion-webui-gfx803-51e3dc9ccad157d7161b697a246e26c868d46a7c.tar.gz stable-diffusion-webui-gfx803-51e3dc9ccad157d7161b697a246e26c868d46a7c.tar.bz2 stable-diffusion-webui-gfx803-51e3dc9ccad157d7161b697a246e26c868d46a7c.zip |
Sanitize hypernet name input.
-rw-r--r-- | modules/hypernetworks/ui.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/hypernetworks/ui.py b/modules/hypernetworks/ui.py index 266f04f6..e6f50a1f 100644 --- a/modules/hypernetworks/ui.py +++ b/modules/hypernetworks/ui.py @@ -11,6 +11,9 @@ from modules.hypernetworks import hypernetwork def create_hypernetwork(name, enable_sizes, overwrite_old, layer_structure=None, add_layer_norm=False, activation_func=None):
+ # Remove illegal characters from name.
+ name = "".join( x for x in name if (x.isalnum() or x in "._- "))
+
fn = os.path.join(shared.cmd_opts.hypernetwork_dir, f"{name}.pt")
if not overwrite_old:
assert not os.path.exists(fn), f"file {fn} already exists"
|