]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3102: FTP directory listing drops fist character of file names
authorMartin von Gagern <martin.vgagern@gmx.net>
Thu, 25 May 2017 11:59:27 +0000 (23:59 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 25 May 2017 11:59:27 +0000 (23:59 +1200)
src/clients/FtpGateway.cc

index 32ebc161419aa524446d4e3d7e0421659d1d8975..a50f2825fef65f900a3783121e80b91b5f77a634 100644 (file)
@@ -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 <mike@starbug.bofh.asn.au> */
-                copyFrom += strlen(tbuf) + 1;
+                copyFrom += strlen(tbuf);
+                if (strchr(w_space, *copyFrom))
+                    ++copyFrom;
             }
 
             p->name = xstrdup(copyFrom);