Chromium Code Reviews| Index: net/ftp/ftp_directory_listing_parser_ls.cc |
| diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc |
| index 89fc3d83d2bc80e4e1db50e208c3244b6a88dc6c..58a9bb9fb8e8514ea3a7ba900803262791db8f53 100644 |
| --- a/net/ftp/ftp_directory_listing_parser_ls.cc |
| +++ b/net/ftp/ftp_directory_listing_parser_ls.cc |
| @@ -127,7 +127,7 @@ bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { |
| // We may receive file names containing spaces, which can make the number of |
| // columns arbitrarily large. We will handle that later. For now just make |
| // sure we have all the columns that should normally be there. |
| - if (columns.size() < 7U + column_offset) |
| + if (columns.size() < 6U + column_offset) |
|
wtc
2010/10/28 01:05:41
It would be nice to document what are the 6 column
Paweł Hajdan Jr.
2010/10/28 07:15:34
Good idea, done.
|
| return false; |
| if (!LooksLikeUnixPermissionsListing(columns[0])) |
| @@ -165,6 +165,14 @@ bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) { |
| } |
| entry.name = FtpUtil::GetStringPartAfterColumns(line, 6 + column_offset); |
| + |
| + if (entry.name.empty()) { |
| + // Some FTP servers send listing entries with empty names. It's not obvious |
| + // how to display such an entry, so we ignore them. We don't want to make |
| + // the parsing fail at this point though. Other entries can still be useful. |
| + return true; |
| + } |
| + |
| if (entry.type == FtpDirectoryListingEntry::SYMLINK) { |
| string16::size_type pos = entry.name.rfind(ASCIIToUTF16(" -> ")); |