diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-04-29 09:55:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-29 09:55:19 +0000 |
commit | fc6eeda69cb37c209754d113a61971d8490f7756 (patch) | |
tree | ea68b566e860bcbb58ebffe922a607d41161c4a6 /modules/api | |
parent | 1dc21d79509cd1437f4bf150872fefdeeaf54ab8 (diff) | |
parent | 70a0a11783747d2e77a08a63d9feeceb7d2d4f63 (diff) | |
download | stable-diffusion-webui-gfx803-fc6eeda69cb37c209754d113a61971d8490f7756.tar.gz stable-diffusion-webui-gfx803-fc6eeda69cb37c209754d113a61971d8490f7756.tar.bz2 stable-diffusion-webui-gfx803-fc6eeda69cb37c209754d113a61971d8490f7756.zip |
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/api')
-rw-r--r-- | modules/api/api.py | 4 |
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): |