From fa4d808a5fbb7a612c36cf15c57e482ab0b41b24 Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sat, 24 Aug 2024 18:45:50 -0700 Subject: [PATCH] Encode uri components when sending automations data to the server --- src/interface/web/app/automations/page.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/interface/web/app/automations/page.tsx b/src/interface/web/app/automations/page.tsx index b6acd6a2..bdd252dc 100644 --- a/src/interface/web/app/automations/page.tsx +++ b/src/interface/web/app/automations/page.tsx @@ -500,19 +500,19 @@ function EditCard(props: EditCardProps) { ); let updateQueryUrl = `/api/automation?`; - updateQueryUrl += `q=${values.queryToRun}`; + updateQueryUrl += `q=${encodeURIComponent(values.queryToRun)}`; if (automation?.id && !props.createNew) { - updateQueryUrl += `&automation_id=${automation.id}`; + updateQueryUrl += `&automation_id=${encodeURIComponent(automation.id)}`; } if (values.subject) { - updateQueryUrl += `&subject=${values.subject}`; + updateQueryUrl += `&subject=${encodeURIComponent(values.subject)}`; } - updateQueryUrl += `&crontime=${cronFrequency}`; + updateQueryUrl += `&crontime=${encodeURIComponent(cronFrequency)}`; if (props.locationData) { - updateQueryUrl += `&city=${props.locationData.city}`; - updateQueryUrl += `®ion=${props.locationData.region}`; - updateQueryUrl += `&country=${props.locationData.country}`; - updateQueryUrl += `&timezone=${props.locationData.timezone}`; + updateQueryUrl += `&city=${encodeURIComponent(props.locationData.city)}`; + updateQueryUrl += `®ion=${encodeURIComponent(props.locationData.region)}`; + updateQueryUrl += `&country=${encodeURIComponent(props.locationData.country)}`; + updateQueryUrl += `&timezone=${encodeURIComponent(props.locationData.timezone)}`; } let method = props.createNew ? "POST" : "PUT";