From 3fa1ebed6295f95d56e0d4b7d4f83f4128e2d78a Mon Sep 17 00:00:00 2001 From: missionfloyd Date: Mon, 18 Mar 2024 21:31:14 -0600 Subject: [PATCH] Escape btn_copy_path filename --- modules/ui_extra_networks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py index 34c46ed40..bfb66a709 100644 --- a/modules/ui_extra_networks.py +++ b/modules/ui_extra_networks.py @@ -10,6 +10,7 @@ from modules.images import read_info_from_image, save_image_with_geninfo import gradio as gr import json import html +import re from fastapi.exceptions import HTTPException from modules.infotext_utils import image_from_url_text @@ -236,7 +237,7 @@ class ExtraNetworksPage: ) onclick = html.escape(onclick) - btn_copy_path = self.btn_copy_path_tpl.format(**{"filename": item["filename"]}) + btn_copy_path = self.btn_copy_path_tpl.format(**{"filename": re.sub(r"[\\\"']", r"\\\g<0>", item["filename"])}) btn_metadata = "" metadata = item.get("metadata") if metadata: