mirror of
https://github.com/supabase/supabase.git
synced 2026-06-09 19:50:28 +08:00
fix(studio): early fail query when x-connection-encrypted is invalid (#35331)
* fix(studio): early fail query when x-connection-encrypted is invalid * fix(studio): uniformize readDatabase and projectDetails connString handling * chore: update api types * chore: add connectionString null option * fix: only enforce x-connection-encrypted on platform * chore: refactor connString check in a single point * chore: fix guard logic * chore: fix pgMetaGuard * chore: fix types
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { QueryKey, useQuery, UseQueryOptions } from '@tanstack/react-query'
|
||||
|
||||
import { handleError as handleErrorFetchers, post } from 'data/fetchers'
|
||||
import { handleError as handleErrorFetchers, isValidConnString, post } from 'data/fetchers'
|
||||
import { useSelectedProject } from 'hooks/misc/useSelectedProject'
|
||||
import { MB, PROJECT_STATUS } from 'lib/constants'
|
||||
import {
|
||||
@@ -12,7 +12,7 @@ import { sqlKeys } from './keys'
|
||||
|
||||
export type ExecuteSqlVariables = {
|
||||
projectRef?: string
|
||||
connectionString?: string
|
||||
connectionString?: string | null
|
||||
sql: string
|
||||
queryKey?: QueryKey
|
||||
handleError?: (error: ResponseError) => { result: any }
|
||||
@@ -42,6 +42,7 @@ export async function executeSql(
|
||||
headersInit?: HeadersInit
|
||||
): Promise<{ result: any }> {
|
||||
if (!projectRef) throw new Error('projectRef is required')
|
||||
if (!isValidConnString(connectionString)) throw new Error('Project connection string is required')
|
||||
|
||||
const sqlSize = new Blob([sql]).size
|
||||
// [Joshen] I think the limit is around 1MB from testing, but its not exactly 1MB it seems
|
||||
|
||||
Reference in New Issue
Block a user