The previous regex for finding net_multi value from given extra_net -- re.search(f'{pen[18]}:(.*)>', pen[2]):
Did not escape user input which could cause errors if lora name had special characters
Fixed by escaping with re.escape
The use of (.*) is greedy and could cause a bad capture group if there were subsequent extra_net patterns in the string
Fixed by making it lazy (.*?)
extra_net settings
extra_net_check and extra_net_defaults were both missing if statements to check that the net did not already exist in the prompt before adding.
extra_net deduplication
If a user added nets manually to the "new prompt" on the edit flow IE a cute cat <lora:myLora> then the callback would add this alongside the calculated extra_nets from the original prompt. A dedup function now removes duplicate occurrences (n > 1) for unique net names in the new prompt IE
a very cute cat, zavy-ctsmtrc <lora:zavy-ctsmtrc-sdxl:0.7> <lora:zavy-ctsmtrc-sdxl:1> <lora:sdxl_lightning_8step_lora:1>
becomes
a very cute cat, zavy-ctsmtrc <lora:zavy-ctsmtrc-sdxl:0.7> <lora:sdxl_lightning_8step_lora:1>
net_multi regex fix
The previous regex for finding
net_multi
value from givenextra_net
--re.search(f'{pen[18]}:(.*)>', pen[2])
:re.escape
(.*)
is greedy and could cause a bad capture group if there were subsequent extra_net patterns in the string(.*?)
extra_net settings
extra_net_check
andextra_net_defaults
were both missing if statements to check that the net did not already exist in the prompt before adding.extra_net deduplication
If a user added nets manually to the "new prompt" on the edit flow IE
a cute cat <lora:myLora>
then the callback would add this alongside the calculated extra_nets from the original prompt. A dedup function now removes duplicate occurrences (n > 1) for unique net names in the new prompt IEa very cute cat, zavy-ctsmtrc <lora:zavy-ctsmtrc-sdxl:0.7> <lora:zavy-ctsmtrc-sdxl:1> <lora:sdxl_lightning_8step_lora:1>
becomes
a very cute cat, zavy-ctsmtrc <lora:zavy-ctsmtrc-sdxl:0.7> <lora:sdxl_lightning_8step_lora:1>