From f69aa07ec13b5b7c281f58c1b0532f1cd41c7cbd Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Mon, 4 Sep 2023 02:51:39 +0300 Subject: [PATCH] Fix background URI encoding --- public/scripts/extensions/stable-diffusion/index.js | 2 +- server.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/public/scripts/extensions/stable-diffusion/index.js b/public/scripts/extensions/stable-diffusion/index.js index 71ace1044..4277a396b 100644 --- a/public/scripts/extensions/stable-diffusion/index.js +++ b/public/scripts/extensions/stable-diffusion/index.js @@ -897,7 +897,7 @@ async function generatePicture(_, trigger, message, callback) { const callbackOriginal = callback; callback = async function (prompt, base64Image) { const imagePath = base64Image; - const imgUrl = `url('${encodeURIComponent(base64Image)}')`; + const imgUrl = `url("${encodeURI(base64Image)}")`; if (typeof window['forceSetBackground'] === 'function') { window['forceSetBackground'](imgUrl); diff --git a/server.js b/server.js index af755ed10..0271efaed 100644 --- a/server.js +++ b/server.js @@ -4764,6 +4764,8 @@ app.post('/api/sd/set-model', jsonParser, async (request, response) => { app.post('/api/sd/generate', jsonParser, async (request, response) => { try { + console.log('SD WebUI request:', request.body); + const url = new URL(request.body.url); url.pathname = '/sdapi/v1/txt2img';