File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
superset-frontend/src/SqlLab/actions Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -336,9 +336,7 @@ export function cleanSqlComments(sql) {
336336 // it sanitizes the following comment block groups
337337 // group 1 -> /* */
338338 // group 2 -> --
339- return sql
340- . replace ( / - - .* ?$ | \/ \/ .* ?$ | \/ \* [ \s \S ] * ?\* \/ | ( \n \s * ) + / gm, '$1' )
341- . trim ( ) ;
339+ return sql . replace ( / ( - - .* ?$ | \/ \* [ \s \S ] * ?\* \/ ) \n ? / gm, '\n' ) . trim ( ) ;
342340}
343341
344342export function runQuery ( query ) {
Original file line number Diff line number Diff line change @@ -296,7 +296,7 @@ describe('async actions', () => {
296296 const makeRequest = ( ) => {
297297 const request = actions . runQuery ( {
298298 ...query ,
299- sql : '/*\nSELECT * FROM\n */\nSELECT 213--, {{ds}}\n/*\n{{new_param1}}\n{{new_param2}}*/FROM table' ,
299+ sql : '/*\nSELECT * FROM\n */\nSELECT 213--, {{ds}}\n/*\n{{new_param1}}\n{{new_param2}}*/\n\nFROM table' ,
300300 } ) ;
301301 return request ( dispatch , ( ) => initialState ) ;
302302 } ;
@@ -310,7 +310,7 @@ describe('async actions', () => {
310310 expect ( fetchMock . calls ( runQueryEndpoint ) ) . toHaveLength ( 1 ) ;
311311 expect (
312312 JSON . parse ( fetchMock . calls ( runQueryEndpoint ) [ 0 ] [ 1 ] . body ) . sql ,
313- ) . toEqual ( 'SELECT 213\nFROM table' ) ;
313+ ) . toEqual ( 'SELECT 213\n\n\ nFROM table' ) ;
314314 } ) ;
315315 } ) ;
316316 } ) ;
You can’t perform that action at this time.
0 commit comments