Forward-port FTP fix from 1.x.
authorCarl Hetherington <cth@carlh.net>
Mon, 12 Jan 2015 11:54:33 +0000 (11:54 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 12 Jan 2015 11:54:33 +0000 (11:54 +0000)
src/lib/internet.cc

index b45eaabf7580ec2c74a0d0559d3b0ed54b377223..b4395fd212c732b3d66da2cb00f07bad34e77dd2 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@
 #include <boost/function.hpp>
 #include <boost/optional.hpp>
 #include <boost/filesystem.hpp>
+#include <boost/algorithm/string.hpp>
 #include <curl/curl.h>
 #include <zip.h>
 #include "scoped_temporary.h"
@@ -33,6 +34,7 @@ using std::string;
 using std::list;
 using boost::optional;
 using boost::function;
+using boost::algorithm::trim;
 
 static size_t
 get_from_zip_url_data (void* buffer, size_t size, size_t nmemb, void* stream)
@@ -138,7 +140,8 @@ ftp_ls (string url)
        SafeStringStream s (ls_raw);
        list<string> ls;
        while (s.good ()) {
-               string const line = s.getline ();
+               string line = s.getline ();
+               trim (line);
                if (line.length() > 55) {
                        string const file = line.substr (55);
                        if (file != "." && file != "..") {