Skip to content

Commit

Permalink
fix: stop lowercasing executed query string (#330)
Browse files Browse the repository at this point in the history
Co-authored-by: peternhale <[email protected]>
  • Loading branch information
aheber and peternhale authored Jul 27, 2022
1 parent 55f5371 commit cfb06b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/api/data/tree/exportApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,10 @@ export class ExportApi {
}
}

config.query = config.query.toLowerCase().trim();
if (!config.query.startsWith('select')) {
throw new SfError(messages.getMessage('soqlInvalid', [config.query]), 'soqlInvalid');

config.query = config.query.trim();
if (!config.query.toLowerCase().startsWith('select')) {
throw SfdxError.create('@salesforce/plugin-data', 'exportApi', 'soqlInvalid', [config.query]);
}

return config;
Expand Down
2 changes: 1 addition & 1 deletion test/commands/force/data/tree/export.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('force:data:tree:export', () => {
return Promise.resolve(ACCOUNT_META);
} else {
const requestMap = ensureJsonMap(request);
if (ensureString(requestMap.url).includes('query?q=select')) {
if (ensureString(requestMap.url).includes('query?q=SELECT')) {
return Promise.resolve(queryResponse);
}
}
Expand Down

0 comments on commit cfb06b7

Please sign in to comment.