mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-05-15 00:09:01 +08:00
use existing quote_js function for #15316
This commit is contained in:
parent
522121be7e
commit
c4a00affc5
@ -1,5 +1,5 @@
|
|||||||
<div class="copy-path-button card-button"
|
<div class="copy-path-button card-button"
|
||||||
title="Copy path to clipboard"
|
title="Copy path to clipboard"
|
||||||
onclick="extraNetworksCopyCardPath(event, '{filename}')"
|
onclick='extraNetworksCopyCardPath(event, {filename})'
|
||||||
data-clipboard-text="{filename}">
|
data-clipboard-text={filename}>
|
||||||
</div>
|
</div>
|
@ -10,7 +10,6 @@ from modules.images import read_info_from_image, save_image_with_geninfo
|
|||||||
import gradio as gr
|
import gradio as gr
|
||||||
import json
|
import json
|
||||||
import html
|
import html
|
||||||
import re
|
|
||||||
from fastapi.exceptions import HTTPException
|
from fastapi.exceptions import HTTPException
|
||||||
|
|
||||||
from modules.infotext_utils import image_from_url_text
|
from modules.infotext_utils import image_from_url_text
|
||||||
@ -152,6 +151,7 @@ def quote_js(s):
|
|||||||
s = s.replace('"', '\\"')
|
s = s.replace('"', '\\"')
|
||||||
return f'"{s}"'
|
return f'"{s}"'
|
||||||
|
|
||||||
|
|
||||||
class ExtraNetworksPage:
|
class ExtraNetworksPage:
|
||||||
def __init__(self, title):
|
def __init__(self, title):
|
||||||
self.title = title
|
self.title = title
|
||||||
@ -239,7 +239,7 @@ class ExtraNetworksPage:
|
|||||||
)
|
)
|
||||||
onclick = html.escape(onclick)
|
onclick = html.escape(onclick)
|
||||||
|
|
||||||
btn_copy_path = self.btn_copy_path_tpl.format(**{"filename": re.sub(r"[\\\"']", r"\\\g<0>", item["filename"])})
|
btn_copy_path = self.btn_copy_path_tpl.format(**{"filename": quote_js(item["filename"])})
|
||||||
btn_metadata = ""
|
btn_metadata = ""
|
||||||
metadata = item.get("metadata")
|
metadata = item.get("metadata")
|
||||||
if metadata:
|
if metadata:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user