Skip to content

Commit

Permalink
Add code to escape member names when doing resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
worksofliam committed Nov 17, 2023
1 parent 2ae070e commit 671fd02
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/IBMiContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,9 @@ export default class IBMiContent {
}

async memberResolve(member: string, files: QsysPath[]): Promise<IBMiMember | undefined> {
const command = `for f in ${files.map(file => `/QSYS.LIB/${file.library.toUpperCase()}.LIB/${file.name.toUpperCase()}.FILE/${member.toUpperCase()}.MBR`).join(` `)}; do if [ -f $f ]; then echo $f; break; fi; done`;
// Escape names for shell
const fixed = files.map(f => ({name: f.name.replace(/([$\\])/g,'\\$1'), library: f.library.replace(/([$\\])/g,'\\$1')}));
const command = `for f in ${fixed.map(file => `/QSYS.LIB/${file.library.toUpperCase()}.LIB/${file.name.toUpperCase()}.FILE/${member.toUpperCase()}.MBR`).join(` `)}; do if [ -f $f ]; then echo $f; break; fi; done`;

const result = await this.ibmi.sendCommand({
command,
Expand Down

0 comments on commit 671fd02

Please sign in to comment.