Chromium Code Reviews| Index: net/ftp/ftp_util.cc |
| diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc |
| index 6c7959f60f6af118cdfdd44a1c8e7948cc85f79e..286a701e185172d3f09553091e71786440468b0f 100644 |
| --- a/net/ftp/ftp_util.cc |
| +++ b/net/ftp/ftp_util.cc |
| @@ -137,7 +137,10 @@ bool FtpUtil::AbbreviatedMonthToNumber(const string16& text, int* number) { |
| // An alternative solution (to parse |text| in given locale) is more |
| // lenient, and may accept more than we want even with setLenient(false). |
| for (int32_t month = 0; month < months_count; month++) { |
| - if (months[month].caseCompare(unicode_text, 0) == 0) { |
| + // Compare (case-insensitive), but just first three characters. Sometimes |
| + // ICU returns longer strings (for example for Russian locale), and in FTP |
| + // listings they are abbreviated to just three characters. |
| + if (months[month].caseCompare(0, 3, unicode_text, 0) == 0) { |
|
gavinp
2011/03/30 17:14:23
NIT: maybe worth noting that caseCompare works whe
Paweł Hajdan Jr.
2011/04/01 15:55:27
Done.
|
| *number = month + 1; |
| return true; |
| } |
| @@ -159,6 +162,8 @@ bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day, |
| if (!base::StringToInt(day, &time_exploded.day_of_month)) |
| return false; |
| + if (time_exploded.day_of_month > 31) |
| + return false; |
| if (!base::StringToInt(rest, &time_exploded.year)) { |
| // Maybe it's time. Does it look like time (HH:MM)? |