diff options
author | Ju1-js <40339350+Ju1-js@users.noreply.github.com> | 2023-02-28 23:55:12 +0000 |
---|---|---|
committer | Ju1-js <40339350+Ju1-js@users.noreply.github.com> | 2023-02-28 23:55:12 +0000 |
commit | 1e30e4d9ebd9c36ccee43ec0e61c6ab490171614 (patch) | |
tree | e8e870fd844a3c814a550e1ae15ddd2eb89389b2 | |
parent | 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8 (diff) | |
download | stable-diffusion-webui-gfx803-1e30e4d9ebd9c36ccee43ec0e61c6ab490171614.tar.gz stable-diffusion-webui-gfx803-1e30e4d9ebd9c36ccee43ec0e61c6ab490171614.tar.bz2 stable-diffusion-webui-gfx803-1e30e4d9ebd9c36ccee43ec0e61c6ab490171614.zip |
Gradio auth logic fix - Handle empty/newlines
When the massive one-liner was split into multiple lines, it lost the ability to handle newlines. This removes empty strings & newline characters from the logins. It also closes the file so it's more robust if the garbage collection function is ever changed.
-rw-r--r-- | webui.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -209,11 +209,12 @@ def webui(): gradio_auth_creds = []
if cmd_opts.gradio_auth:
- gradio_auth_creds += cmd_opts.gradio_auth.strip('"').replace('\n', '').split(',')
+ gradio_auth_creds += [x.strip() for x in cmd_opts.gradio_auth.strip('"').replace('/n', '').split(',') if x.strip()]
if cmd_opts.gradio_auth_path:
with open(cmd_opts.gradio_auth_path, 'r', encoding="utf8") as file:
for line in file.readlines():
- gradio_auth_creds += [x.strip() for x in line.split(',')]
+ gradio_auth_creds += [x.strip() for x in line.split(',') if x.strip()]
+ file.close()
app, local_url, share_url = shared.demo.launch(
share=cmd_opts.share,
|