diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/base/dir_header.html | 2 | ||||
-rw-r--r-- | net/ftp/ftp_directory_listing_parser_ls_unittest.cc | 4 | ||||
-rw-r--r-- | net/ftp/ftp_util.cc | 24 |
3 files changed, 21 insertions, 9 deletions
diff --git a/net/base/dir_header.html b/net/base/dir_header.html index ad4ec0a..4f33bba 100644 --- a/net/base/dir_header.html +++ b/net/base/dir_header.html @@ -62,7 +62,7 @@ function onListingParsingError() { var box = document.getElementById("listingParsingErrorBox"); box.innerHTML = box.innerHTML.replace("LOCATION", encodeURI(document.location) + "?raw"); - box.style.display = ""; + box.style.display = "block"; } </script> diff --git a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc index 608e0e2..c67c928 100644 --- a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc +++ b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc @@ -45,6 +45,9 @@ TEST_F(FtpDirectoryListingParserLsTest, Good) { { "d-wx-wx-wt+ 4 ftp 989 512 Dec 8 15:54 incoming", net::FtpDirectoryListingEntry::DIRECTORY, "incoming", -1, 1993, 12, 8, 15, 54 }, + { "drwxrwxrwx 1 owner group 0 Sep 13 0:30 audio", + net::FtpDirectoryListingEntry::DIRECTORY, "audio", -1, + 1994, 9, 13, 0, 30 }, // Tests for the wu-ftpd variant: { "drwxr-xr-x 2 sys 512 Mar 27 2009 pub", @@ -100,6 +103,7 @@ TEST_F(FtpDirectoryListingParserLsTest, Bad) { "qrwwr--r-- 1 ftp ftp 528 Nov 01 2007 README", "-rw-r--r-- 1 ftp ftp -528 Nov 01 2007 README", "-rw-r--r-- 1 ftp ftp 528 Foo 01 2007 README", + "drwxrwxrwx 1 owner group 0 Sep 13 0:3 audio", "d-wx-wx-wt++ 4 ftp 989 512 Dec 8 15:54 incoming", "d-wx-wx-wt$ 4 ftp 989 512 Dec 8 15:54 incoming", diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc index 269a063..aeb2355 100644 --- a/net/ftp/ftp_util.cc +++ b/net/ftp/ftp_util.cc @@ -160,15 +160,23 @@ bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day, return false; if (!base::StringToInt(rest, &time_exploded.year)) { - // Maybe it's time. Does it look like time (MM:HH)? - if (rest.length() != 5 || rest[2] != ':') - return false; - - if (!base::StringToInt(rest.substr(0, 2), &time_exploded.hour)) - return false; - - if (!base::StringToInt(rest.substr(3, 2), &time_exploded.minute)) + // Maybe it's time. Does it look like time (HH:MM)? + if (rest.length() == 5 && rest[2] == ':') { + if (!base::StringToInt(rest.substr(0, 2), &time_exploded.hour)) + return false; + + if (!base::StringToInt(rest.substr(3, 2), &time_exploded.minute)) + return false; + } else if (rest.length() == 4 && rest[1] == ':') { + // Sometimes it's just H:MM. + if (!base::StringToInt(rest.substr(0, 1), &time_exploded.hour)) + return false; + + if (!base::StringToInt(rest.substr(2, 2), &time_exploded.minute)) + return false; + } else { return false; + } // Guess the year. base::Time::Exploded current_exploded; |