From 3d8720905ac3e4b4e5ed3ae4c27592c6959ca4e1 Mon Sep 17 00:00:00 2001 From: Martin von Gagern Date: Tue, 16 May 2017 18:38:36 +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 8e83f22a26..0ae873d54d 100644 --- a/src/clients/FtpGateway.cc +++ b/src/clients/FtpGateway.cc @@ -618,10 +618,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