Skip to content

Commit

Permalink
Merge pull request #2318 from codefori/fix/always_escape_path
Browse files Browse the repository at this point in the history
Fix encoding issue when writing files
  • Loading branch information
worksofliam authored Nov 1, 2024
2 parents feaeeae + b1b6eba commit dc05223
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/api/IBMiContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default class IBMiContent {
ccsid = await this.getNotUTF8CCSID(features.attr, originalPath);
}

await writeFileAsync(tmpobj, content, encoding);
await writeFileAsync(tmpobj, content, {encoding: encoding as BufferEncoding});

if (ccsid && features.iconv) {
// Upload our file to the same temp file, then write convert it back to the original ccsid
Expand Down Expand Up @@ -951,7 +951,7 @@ export default class IBMiContent {
}

async getAttributes(path: string | (QsysPath & { member?: string }), ...operands: AttrOperands[]) {
const target = (path = typeof path === 'string' ? Tools.escapePath(path) : this.ibmi.sysNameInAmerican(Tools.qualifyPath(path.library, path.name, path.member, path.asp)));
const target = Tools.escapePath(path = typeof path === 'string' ? path : this.ibmi.sysNameInAmerican(Tools.qualifyPath(path.library, path.name, path.member, path.asp)));

const result = await this.ibmi.sendCommand({ command: `${this.ibmi.remoteFeatures.attr} -p ${target} ${operands.join(" ")}` });
if (result.code === 0) {
Expand Down

0 comments on commit dc05223

Please sign in to comment.