aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-04-29 12:55:19 +0300
committerGitHub <noreply@github.com>2023-04-29 12:55:19 +0300
commitfc6eeda69cb37c209754d113a61971d8490f7756 (patch)
treeea68b566e860bcbb58ebffe922a607d41161c4a6 /modules
parent1dc21d79509cd1437f4bf150872fefdeeaf54ab8 (diff)
parent70a0a11783747d2e77a08a63d9feeceb7d2d4f63 (diff)
Merge pull request #9130 from Vespinian/fix-api-alwayson_scripts-less-then-requiered-args
[Fix] Prevent alwayson_scripts args param resizing script_arg list when they are inserted in it
Diffstat (limited to 'modules')
-rw-r--r--modules/api/api.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/api/api.py b/modules/api/api.py
index 5ed670e9..9ffcbd5f 100644
--- a/modules/api/api.py
+++ b/modules/api/api.py
@@ -271,7 +271,9 @@ class Api:
raise HTTPException(status_code=422, detail=f"Cannot have a selectable script in the always on scripts params")
# always on script with no arg should always run so you don't really need to add them to the requests
if "args" in request.alwayson_scripts[alwayson_script_name]:
- script_args[alwayson_script.args_from:alwayson_script.args_to] = request.alwayson_scripts[alwayson_script_name]["args"]
+ # min between arg length in scriptrunner and arg length in the request
+ for idx in range(0, min((alwayson_script.args_to - alwayson_script.args_from), len(request.alwayson_scripts[alwayson_script_name]["args"]))):
+ script_args[alwayson_script.args_from + idx] = request.alwayson_scripts[alwayson_script_name]["args"][idx]
return script_args
def text2imgapi(self, txt2imgreq: StableDiffusionTxt2ImgProcessingAPI):