From d9a90bf7eace826ae4db90086a3e706ee2e04485 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Thu, 25 May 2017 23:59:27 +1200 Subject: [PATCH] Bug 3102: FTP directory listing drops fist character of file names --- src/clients/FtpGateway.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/clients/FtpGateway.cc b/src/clients/FtpGateway.cc index 32ebc16141..a50f2825fe 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -619,10 +619,17 @@ ftpListParseParts(const char *buf, struct Ftp::GatewayFlags flags) while (strchr(w_space, *copyFrom)) ++copyFrom; } else { - /* XXX assumes a single space between date and filename + /* Handle the following four formats: + * "MMM DD YYYY Name" + * "MMM DD YYYYName" + * "MMM DD YYYY Name" + * "MMM DD YYYY Name" + * Assuming a single space between date and filename * suggested by: Nathan.Bailey@cc.monash.edu.au and * Mike Battersby */ - copyFrom += strlen(tbuf) + 1; + copyFrom += strlen(tbuf); + if (strchr(w_space, *copyFrom)) + ++copyFrom; } p->name = xstrdup(copyFrom); -- 2.47.3