Skip to content

Commit

Permalink
fix(QueryBuilder): Better whitespace splitting for select lists
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Dec 20, 2019
1 parent 74649bd commit 6f771e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions models/Query/QueryBuilder.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2570,9 +2570,9 @@ component displayname="QueryBuilder" accessors="true" {
}

try {
var cfArray = [];
cfArray.append( trim( arguments.listOrArray ).split( ",\s*" ), true );
return cfArray;
return arrayMap( trim( arguments.listOrArray ).split( ",\s*" ), function( item ) {
return trim( item );
} );
} catch ( any e ) {
return arguments.listOrArray;
}
Expand Down
3 changes: 2 additions & 1 deletion tests/specs/Query/Abstract/BuilderSelectSpec.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ component extends="testbox.system.BaseSpec" {
it( "trims a list before splitting it", function() {
query.select( "
::some_column::, ::another_column::
,::third_column::
" );
expect( query.getColumns() ).toBe( [ "::some_column::", "::another_column::" ] );
expect( query.getColumns() ).toBe( [ "::some_column::", "::another_column::", "::third_column::" ] );
} );

it( "using an array", function() {
Expand Down

0 comments on commit 6f771e3

Please sign in to comment.