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

fix: paths contain non-ascii characters cause error #381

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ios/lib/client/afc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class AFCClient extends ServiceClient<AFCProtocolClient> {
async openFile(path: string): Promise<Buffer> {
debug(`openFile: ${path}`);
// mode + path + null terminator
const data = Buffer.alloc(8 + path.length + 1);
const data = Buffer.alloc(8 + Buffer.byteLength(path) + 1);
// write mode
data.writeUInt32LE(AFC_FILE_OPEN_FLAGS.WRONLY, 0);
// then path to file
Expand Down Expand Up @@ -176,7 +176,7 @@ export class AFCClient extends ServiceClient<AFCProtocolClient> {
}

function toCString(s: string) {
const buf = Buffer.alloc(s.length + 1);
const buf = Buffer.alloc(Buffer.byteLength(s) + 1);
const len = buf.write(s);
buf.writeUInt8(0, len);
return buf;
Expand Down