Skip to content

Commit

Permalink
Merge pull request #1655 from codefori/fix/escape_dollar_signs_in_lookup
Browse files Browse the repository at this point in the history
Add code to escape member names when doing resolve
  • Loading branch information
sebjulliand authored Nov 21, 2023
2 parents 99c912b + b9eed16 commit db5bb99
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/api/IBMiContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,14 @@ 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 pathList = files
.map(file => `/QSYS.LIB/${file.library}.LIB/${file.name}.FILE/${member}.MBR`)
.join(` `)
.replace(/([$\\])/g,'\\$1')
.toUpperCase();

const command = `for f in ${pathList}; do if [ -f $f ]; then echo $f; break; fi; done`;
const result = await this.ibmi.sendCommand({
command,
});
Expand Down

0 comments on commit db5bb99

Please sign in to comment.