Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: net/ftp/ftp_directory_listing_parser_ls.cc

Issue 3774002: Fix FTP directory listing for ftp.cisco.com. (Closed)
Patch Set: fixes Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 038af116ccbb3bd95196e2a24d983bc9591dcc0b..8e7eee83632fe9830bfd5e64d80b0d264df16ae1 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -140,8 +140,15 @@ bool FtpDirectoryListingParserLs::ConsumeLine(const string16& line) {
entry.type = FtpDirectoryListingEntry::FILE;
}
- if (!base::StringToInt64(columns[2 + column_offset], &entry.size))
- return false;
+ if (!base::StringToInt64(columns[2 + column_offset], &entry.size)) {
+ // Some FTP servers do not separate owning group name from file size,
+ // like "group1234". We still want to display the file name for that entry,
+ // but can't really get the size (What if the group is named "group1",
+ // and the size is in fact 234? We can't distinguish between that
+ // and "group" with size 1234). Use a dummy value for the size.
+ // TODO(phajdan.jr): Use a value that means "unknown" instead of 0 bytes.
+ entry.size = 0;
+ }
if (entry.size < 0)
return false;
if (entry.type != FtpDirectoryListingEntry::FILE)
« no previous file with comments | « net/ftp/ftp_directory_listing_buffer_unittest.cc ('k') | net/ftp/ftp_directory_listing_parser_ls_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698