Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
5ed7daa3
Commit
5ed7daa3
authored
Dec 02, 2023
by
AUTOMATIC1111
Committed by
GitHub
Dec 02, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14120 from AUTOMATIC1111/protect-against-bad-ui-creation-scripts
catch uncaught exception with ui creation scripts
parents
ef1723ef
8a6e4bda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
25 deletions
+29
-25
modules/scripts.py
modules/scripts.py
+29
-25
No files found.
modules/scripts.py
View file @
5ed7daa3
...
@@ -570,40 +570,44 @@ class ScriptRunner:
...
@@ -570,40 +570,44 @@ class ScriptRunner:
if
controls
is
None
:
if
controls
is
None
:
return
return
script
.
name
=
wrap_call
(
script
.
title
,
script
.
filename
,
"title"
,
default
=
script
.
filename
)
.
lower
()
try
:
api_args
=
[]
script
.
name
=
wrap_call
(
script
.
title
,
script
.
filename
,
"title"
,
default
=
script
.
filename
)
.
lower
()
api_args
=
[]
for
control
in
controls
:
for
control
in
controls
:
control
.
custom_script_source
=
os
.
path
.
basename
(
script
.
filename
)
control
.
custom_script_source
=
os
.
path
.
basename
(
script
.
filename
)
arg_info
=
api_models
.
ScriptArg
(
label
=
control
.
label
or
""
)
arg_info
=
api_models
.
ScriptArg
(
label
=
control
.
label
or
""
)
for
field
in
(
"value"
,
"minimum"
,
"maximum"
,
"step"
):
for
field
in
(
"value"
,
"minimum"
,
"maximum"
,
"step"
):
v
=
getattr
(
control
,
field
,
None
)
v
=
getattr
(
control
,
field
,
None
)
if
v
is
not
None
:
if
v
is
not
None
:
setattr
(
arg_info
,
field
,
v
)
setattr
(
arg_info
,
field
,
v
)
choices
=
getattr
(
control
,
'choices'
,
None
)
# as of gradio 3.41, some items in choices are strings, and some are tuples where the first elem is the string
choices
=
getattr
(
control
,
'choices'
,
None
)
# as of gradio 3.41, some items in choices are strings, and some are tuples where the first elem is the string
if
choices
is
not
None
:
if
choices
is
not
None
:
arg_info
.
choices
=
[
x
[
0
]
if
isinstance
(
x
,
tuple
)
else
x
for
x
in
choices
]
arg_info
.
choices
=
[
x
[
0
]
if
isinstance
(
x
,
tuple
)
else
x
for
x
in
choices
]
api_args
.
append
(
arg_info
)
api_args
.
append
(
arg_info
)
script
.
api_info
=
api_models
.
ScriptInfo
(
script
.
api_info
=
api_models
.
ScriptInfo
(
name
=
script
.
name
,
name
=
script
.
name
,
is_img2img
=
script
.
is_img2img
,
is_img2img
=
script
.
is_img2img
,
is_alwayson
=
script
.
alwayson
,
is_alwayson
=
script
.
alwayson
,
args
=
api_args
,
args
=
api_args
,
)
)
if
script
.
infotext_fields
is
not
None
:
if
script
.
infotext_fields
is
not
None
:
self
.
infotext_fields
+=
script
.
infotext_fields
self
.
infotext_fields
+=
script
.
infotext_fields
if
script
.
paste_field_names
is
not
None
:
if
script
.
paste_field_names
is
not
None
:
self
.
paste_field_names
+=
script
.
paste_field_names
self
.
paste_field_names
+=
script
.
paste_field_names
self
.
inputs
+=
controls
self
.
inputs
+=
controls
script
.
args_to
=
len
(
self
.
inputs
)
script
.
args_to
=
len
(
self
.
inputs
)
except
Exception
:
errors
.
report
(
f
"Error creating UI for {script.name}: "
,
exc_info
=
True
)
def
setup_ui_for_section
(
self
,
section
,
scriptlist
=
None
):
def
setup_ui_for_section
(
self
,
section
,
scriptlist
=
None
):
if
scriptlist
is
None
:
if
scriptlist
is
None
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment