Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code to escape member names when doing resolve #1655

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`;
worksofliam marked this conversation as resolved.
Show resolved Hide resolved

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