Chromium Code Reviews| Index: net/ftp/ftp_directory_listing_parser_ls.cc |
| =================================================================== |
| --- net/ftp/ftp_directory_listing_parser_ls.cc (revision 131350) |
| +++ net/ftp/ftp_directory_listing_parser_ls.cc (working copy) |
| @@ -51,21 +51,6 @@ |
| LooksLikeUnixPermission(text.substr(4, 3))); |
| } |
| -bool LooksLikePermissionDeniedError(const string16& text) { |
| - // Try to recognize a three-part colon-separated error message: |
| - // |
| - // 1. ftpd server name |
| - // 2. directory name (often just ".") |
| - // 3. message text (usually "Permission denied") |
| - std::vector<string16> parts; |
| - base::SplitString(CollapseWhitespace(text, false), ':', &parts); |
| - |
| - if (parts.size() != 3) |
| - return false; |
| - |
| - return parts[2].find(ASCIIToUTF16("Permission denied")) != string16::npos; |
| -} |
| - |
| // Returns the column index of the end of the date listing and detected |
| // last modification time. |
| bool DetectColumnOffsetAndModificationTime(const std::vector<string16>& columns, |
| @@ -159,10 +144,11 @@ |
| current_time, |
| &column_offset, |
| &entry.last_modified)) { |
| - // If we can't recognize a normal listing line, maybe it's an error? |
| - // In that case, just ignore the error, but still recognize the data |
| - // as valid listing. |
| - if (LooksLikePermissionDeniedError(lines[i])) |
| + // Some servers send a message in on of the first few lines. |
|
eroman
2012/04/13 18:37:26
nit: "in on of the" --> "in one of the".
Paweł Hajdan Jr.
2012/04/14 10:12:14
Done.
|
| + // All those messages have in common is the string ".:", |
| + // where "." means the current directory, and ":" separates it |
| + // from the rest of the message, which may be empty. |
| + if (lines[i].find(ASCIIToUTF16(".:")) != string16::npos) |
|
gavinp
2012/04/12 18:03:14
LGTM. Initially I thought this was going to not a
Paweł Hajdan Jr.
2012/04/13 16:02:34
This is parser of "ls -l" format. We have other fo
|
| continue; |
| return false; |