aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVespinian <vespinian@proton.me>2023-03-28 23:52:51 -0400
committerVespinian <vespinian@proton.me>2023-03-28 23:52:51 -0400
commit70a0a11783747d2e77a08a63d9feeceb7d2d4f63 (patch)
tree2173717cfcf5bb199488fa11d36f3f843579ad12
parent3856ada5cc9ac4124e20ff311ce7aa77330845d9 (diff)
Changed behavior that puts the args from alwayson_script request in the script_args, so don't accidently resize the arg list if we get less arg then or default list has
-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 518b2a61..8c5cd185 100644
--- a/modules/api/api.py
+++ b/modules/api/api.py
@@ -272,7 +272,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):