mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
1 parent
a7705d369c
commit
df40b598ff
2 files changed
+7
-1
No files matched your search
@@ -550,6 +550,8 @@ export function checkForILIKEClause(query: string) {
|
||||
export function checkForWildcard(query: string) {
|
||||
const queryWithoutComments = query.replace(/--.*$/gm, '').replace(/\/\*[\s\S]*?\*\//gm, '')
|
||||
|
||||
const queryWithoutCount = queryWithoutComments.replace(/count\(\*\)/gi, '')
|
||||
|
||||
const wildcardRegex = /\*/
|
||||
return wildcardRegex.test(queryWithoutComments)
|
||||
return wildcardRegex.test(queryWithoutCount)
|
||||
}
|
||||
@@ -91,4 +91,8 @@ describe('checkForWildcard', () => {
|
||||
expect(checkForWildcard('-- *\nSELECT column FROM table')).toBe(false)
|
||||
expect(checkForWildcard('/* * */\nSELECT column FROM table')).toBe(false)
|
||||
})
|
||||
|
||||
test('count(*)', () => {
|
||||
expect(checkForWildcard('SELECT count(*) FROM table')).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user