The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: escape quotes (#45848)
Vaibhavfe769bfe7e4f
diff --git a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.tsx b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.tsxindex b56d313668a..522b0bb71d5 100644--- a/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.tsx+++ b/apps/studio/components/interfaces/Integrations/CronJobs/CronJobs.utils.tsx@@ -135,7 +135,7 @@ export const parseCronJobCommand = (originalCommand: string, projectRef: string)const regexDBFunction = /select\s+[a-zA-Z0-9_]+\.[a-zA-Z0-9_]+\s*\(\)/gif (command.toLocaleLowerCase().match(regexDBFunction)) {const [schemaName, functionName] = command- .replace('SELECT ', '')+ .replace(/^select\s+/i, '').replace(/\(.*\);*/, '').trim()diff --git a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.ts b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.tsindex 0de20cdbe37..86e4de98f7b 100644--- a/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.ts+++ b/apps/studio/components/interfaces/UnifiedLogs/UnifiedLogs.queries.ts@@ -11,6 +11,7 @@ const SPECIAL_FILTER_PARAMS = ['date'] as const// Combined list of all parameters to exclude from standard filteringconst EXCLUDED_QUERY_PARAMS = [...PAGINATION_PARAMS, ...SPECIAL_FILTER_PARAMS] as const+const FACET_FIELDS = ['log_type', 'level', 'method', 'status', 'pathname'] as const/*** Builds query conditions from search parameters and returns WHERE clause@@ -29,16 +30,18 @@ const buildQueryConditions = (search: QuerySearchParamsType) => {// Handle array filters (IN clause)if (Array.isArray(value) && value.length > 0) {- whereConditions.push(`${key} IN (${value.map((v) => `'${v}'`).join(',')})`)+ whereConditions.push(+ `${key} IN (${value.map((v) => `'${String(v).replace(/'/g, "''")}'`).join(',')})`+ )return}// Handle scalar valuesif (value !== null && value !== undefined) {if (['host', 'pathname'].includes(key)) {- whereConditions.push(`${key} LIKE '%${value}%'`)+ whereConditions.push(`${key} LIKE '%${String(value).replace(/'/g, "''")}%'`)} else {- whereConditions.push(`${key} = '${value}'`)+ whereConditions.push(`${key} = '${String(value).replace(/'/g, "''")}'`)}}})@@ -379,16 +382,18 @@ const buildFacetWhere = (search: QuerySearchParamsType, excludeField: string): s// Handle array filters (IN clause)if (Array.isArray(value) && value.length > 0) {- conditions.push(`${key} IN (${value.map((v) => `'${v}'`).join(',')})`)+ conditions.push(+ `${key} IN (${value.map((v) => `'${String(v).replace(/'/g, "''")}'`).join(',')})`+ )return}// Handle scalar valuesif (value !== null && value !== undefined) {if (['host', 'pathname'].includes(key)) {- conditions.push(`${key} LIKE '%${value}%'`)+ conditions.push(`${key} LIKE '%${String(value).replace(/'/g, "''")}%'`)} else {- conditions.push(`${key} = '${value}'`)+ conditions.push(`${key} = '${String(value).replace(/'/g, "''")}'`)}}})@@ -405,6 +410,10 @@ export const getFacetCountCTE = ({facet: stringfacetSearch?: string}) => {+ if (!(FACET_FIELDS as readonly string[]).includes(facet)) {+ throw new Error('Invalid unified logs facet')+ }+const MAX_FACETS_QUANTITY = 20return `@@ -413,7 +422,7 @@ ${facet}_count AS (FROM unified_logs${buildFacetWhere(search, `${facet}`) || `WHERE ${facet} IS NOT NULL`}${buildFacetWhere(search, `${facet}`) ? ` AND ${facet} IS NOT NULL` : ''}- ${!!facetSearch ? `AND ${facet} LIKE '%${facetSearch}%'` : ''}+ ${!!facetSearch ? `AND ${facet} LIKE '%${facetSearch.replace(/'/g, "''")}%'` : ''}GROUP BY ${facet}LIMIT ${MAX_FACETS_QUANTITY})