From b0405ff1c1ba1c4ea46182aed3828747b62b6f8f Mon Sep 17 00:00:00 2001 From: Patrick Juchli Date: Sat, 23 Dec 2023 17:45:30 +0100 Subject: [PATCH] Protect list command constants --- src/Client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client.ts b/src/Client.ts index bbce545..f80e199 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -58,7 +58,7 @@ const LIST_COMMANDS_MLSD: readonly string[] = ["MLSD", "LIST -a", "LIST"] export class Client { prepareTransfer: TransferStrategy parseList: RawListParser - availableListCommands = LIST_COMMANDS_DEFAULT + availableListCommands = LIST_COMMANDS_DEFAULT.slice() /** Low-level API to interact with FTP server. */ readonly ftp: FTPContext /** Tracks progress of data transfers. */ @@ -234,7 +234,7 @@ export class Client { // Use MLSD directory listing if possible. See https://tools.ietf.org/html/rfc3659#section-7.8: // "The presence of the MLST feature indicates that both MLST and MLSD are supported." const supportsMLSD = features.has("MLST") - this.availableListCommands = supportsMLSD ? LIST_COMMANDS_MLSD : LIST_COMMANDS_DEFAULT + this.availableListCommands = supportsMLSD ? LIST_COMMANDS_MLSD.slice() : LIST_COMMANDS_DEFAULT.slice() await this.send("TYPE I") // Binary mode await this.sendIgnoringError("STRU F") // Use file structure await this.sendIgnoringError("OPTS UTF8 ON") // Some servers expect UTF-8 to be enabled explicitly and setting before login might not have worked.