]> 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>
Mon, 29 May 2017 04:36:11 +0000 (16:36 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 29 May 2017 04:36:11 +0000 (16:36 +1200)
src/clients/FtpGateway.cc

index 6045cc7d6e7a666a585eb9154c0cebdd0c145ec7..acc52c7fd2c5aa24b92176740ae9c3cead895601 100644 (file)
@@ -626,10 +626,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);