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

Don't clean destination in getFile command #53

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Changes from all commits
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
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ const singleSlash = /\//g;
const missingFileRegex =
/(NT_STATUS_OBJECT_NAME_NOT_FOUND|NT_STATUS_NO_SUCH_FILE)/im;

const getCleanedSmbClientArgs = (args) =>
args.map((arg) => `"${arg.replace(singleSlash, "\\")}"`).join(" ");
const getCleanedSmbClientArgs = (args) => {
if (Array.isArray(args)) {
return args.map((arg) => `"${arg.replace(singleSlash, "\\")}"`).join(" ");
} else {
return `"${args.replace(singleSlash, "\\")}"`;
}
}

class SambaClient {
constructor(options) {
Expand All @@ -29,7 +34,7 @@ class SambaClient {
}

async getFile(path, destination, workingDir) {
return await this.execute("get", [path, destination], workingDir);
return await this.execute("get", `${getCleanedSmbClientArgs(path)} "${destination}"`, workingDir);
}

async sendFile(path, destination) {
Expand Down