diff options
author | AUTOMATIC <16777216c@gmail.com> | 2023-01-23 20:11:34 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2023-01-23 20:11:34 +0000 |
commit | 7b1c7ba87b14da9960d0347269421233f4cb5838 (patch) | |
tree | ae34b8dd62974980ef9d1e9d0f27914af0a99029 | |
parent | 865af20d8a4a823df3c950f5c9c9092a541bc57a (diff) | |
download | stable-diffusion-webui-gfx803-7b1c7ba87b14da9960d0347269421233f4cb5838.tar.gz stable-diffusion-webui-gfx803-7b1c7ba87b14da9960d0347269421233f4cb5838.tar.bz2 stable-diffusion-webui-gfx803-7b1c7ba87b14da9960d0347269421233f4cb5838.zip |
add support for apostrophe in extra network names
-rw-r--r-- | html/extra-networks-card.html | 4 | ||||
-rw-r--r-- | modules/ui_extra_networks.py | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/html/extra-networks-card.html b/html/extra-networks-card.html index 1bdf1d27..aa9fca87 100644 --- a/html/extra-networks-card.html +++ b/html/extra-networks-card.html @@ -1,8 +1,8 @@ -<div class='card' {preview_html} onclick='return cardClicked({tabname}, {prompt}, {allow_negative_prompt})'> +<div class='card' {preview_html} onclick={card_clicked}> <div class='actions'> <div class='additional'> <ul> - <a href="#" title="replace preview image with currently selected in gallery" onclick='return saveCardPreview(event, {tabname}, {local_preview})'>replace preview</a> + <a href="#" title="replace preview image with currently selected in gallery" onclick={save_card_preview}>replace preview</a> </ul> </div> <span class='name'>{name}</span> diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 2ddac3d8..8b4f97f8 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -3,6 +3,7 @@ import os.path from modules import shared
import gradio as gr
import json
+import html
from modules.generation_parameters_copypaste import image_from_url_text
@@ -54,12 +55,13 @@ class ExtraNetworksPage: preview = item.get("preview", None)
args = {
- "preview_html": "style='background-image: url(" + json.dumps(preview) + ")'" if preview else '',
+ "preview_html": "style='background-image: url(\"" + html.escape(preview) + "\")'" if preview else '',
"prompt": item["prompt"],
"tabname": json.dumps(tabname),
"local_preview": json.dumps(item["local_preview"]),
"name": item["name"],
- "allow_negative_prompt": "true" if self.allow_negative_prompt else "false",
+ "card_clicked": '"' + html.escape(f"""return cardClicked({json.dumps(tabname)}, {item["prompt"]}, {"true" if self.allow_negative_prompt else "false"})""") + '"',
+ "save_card_preview": '"' + html.escape(f"""return saveCardPreview(event, {json.dumps(tabname)}, {json.dumps(item["local_preview"])})""") + '"',
}
return self.card_page.format(**args)
|