From d503dbb510a62259318d34de7e26bcdbab1788a0 Mon Sep 17 00:00:00 2001 From: Christian Bastian <80225746+cdb-boop@users.noreply.github.com> Date: Sat, 7 Sep 2024 17:47:25 -0400 Subject: [PATCH] Fix URI model path requests for opening model url. --- web/model-manager.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/model-manager.js b/web/model-manager.js index 35330f1..d5bd037 100644 --- a/web/model-manager.js +++ b/web/model-manager.js @@ -140,11 +140,13 @@ async function loadWorkflow(url) { } /** - * @param {string} modelPath + * @param {string} modelSearchPath * @returns {Promise} */ -async function tryOpenModelUrl(modelPath) { - const webUrlResponse = await comfyRequest(`/model-manager/model/info/web-url?path=${modelPath}`); +async function tryOpenModelUrl(modelSearchPath) { + const encodedPath = encodeURIComponent(modelSearchPath); + const requestUrl = `/model-manager/model/info/web-url?path=${encodedPath}`; + const webUrlResponse = await comfyRequest(requestUrl); try { const modelUrl = new URL(webUrlResponse["url"]); window.open(modelUrl, '_blank').focus(); @@ -2546,7 +2548,7 @@ class ModelInfo { action: async (e) => { const [button, icon, span] = comfyButtonDisambiguate(e.target); button.disabled = true; - const success = await tryOpenModelUrl(path); + const success = await tryOpenModelUrl(searchPath); comfyButtonAlert(e.target, success, "mdi-check-bold", "mdi-close-thick"); button.disabled = false; },