SimpleChatTC:WebFetch:UrlEnc url2fetch b4Passing toProxy asQuery

Ensures that if the url being requested as any query strings in
them then things dont get messed up, when the url to get inc its
query is extracted from the proxy request's query string
This commit is contained in:
hanishkvc 2025-10-17 05:22:13 +05:30
parent 9ff2c596ee
commit 8b950fd348
1 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@ let weburlfetch_meta = {
*/
function weburlfetch_run(toolcallid, toolname, obj) {
if (gToolsWorker.onmessage != null) {
let newUrl = `http://127.0.0.1:3128/urlraw?url=${obj.url}`
let newUrl = `http://127.0.0.1:3128/urlraw?url=${encodeURIComponent(obj.url)}`
fetch(newUrl).then(resp=>resp.text()).then(data => {
message_toolsworker(new MessageEvent('message', {data: {id: toolcallid, name: toolname, data: data}}))
}).catch((err)=>{
@ -158,7 +158,7 @@ let weburlfetchstrip_meta = {
*/
function weburlfetchstrip_run(toolcallid, toolname, obj) {
if (gToolsWorker.onmessage != null) {
let newUrl = `http://127.0.0.1:3128/urltext?url=${obj.url}`
let newUrl = `http://127.0.0.1:3128/urltext?url=${encodeURIComponent(obj.url)}`
fetch(newUrl).then(resp=>resp.text()).then(data => {
message_toolsworker(new MessageEvent('message', {data: {id: toolcallid, name: toolname, data: data}}))
}).catch((err)=>{