Skip to content

Commit

Permalink
use existing quote_js function for #15316
Browse files Browse the repository at this point in the history
  • Loading branch information
AUTOMATIC1111 committed Mar 19, 2024
1 parent 522121b commit c4a00af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions html/extra-networks-copy-path-button.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="copy-path-button card-button"
title="Copy path to clipboard"
onclick="extraNetworksCopyCardPath(event, '{filename}')"
data-clipboard-text="{filename}">
onclick='extraNetworksCopyCardPath(event, {filename})'
data-clipboard-text={filename}>
</div>
4 changes: 2 additions & 2 deletions modules/ui_extra_networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import gradio as gr
import json
import html
import re
from fastapi.exceptions import HTTPException

from modules.infotext_utils import image_from_url_text
Expand Down Expand Up @@ -152,6 +151,7 @@ def quote_js(s):
s = s.replace('"', '\\"')
return f'"{s}"'


class ExtraNetworksPage:
def __init__(self, title):
self.title = title
Expand Down Expand Up @@ -239,7 +239,7 @@ def create_item_html(
)
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 = ""
metadata = item.get("metadata")
if metadata:
Expand Down

0 comments on commit c4a00af

Please sign in to comment.