Merge pull request #8202 from Ju1-js/master

Gradio auth logic fix - Handle empty/newlines
This commit is contained in:
AUTOMATIC1111 2023-03-11 14:02:07 +03:00 committed by GitHub
commit 9df72be90e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -209,11 +209,11 @@ def webui():
gradio_auth_creds = [] gradio_auth_creds = []
if cmd_opts.gradio_auth: 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: if cmd_opts.gradio_auth_path:
with open(cmd_opts.gradio_auth_path, 'r', encoding="utf8") as file: with open(cmd_opts.gradio_auth_path, 'r', encoding="utf8") as file:
for line in file.readlines(): 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()]
app, local_url, share_url = shared.demo.launch( app, local_url, share_url = shared.demo.launch(
share=cmd_opts.share, share=cmd_opts.share,