Index: net/ftp/ftp_util.cc |
diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc |
index f6bdf2f83db9de6946abef3e940b0ec81c3a6c84..febb35036e1e29830442bdb6ca1761fbdbfa8e63 100644 |
--- a/net/ftp/ftp_util.cc |
+++ b/net/ftp/ftp_util.cc |
@@ -203,8 +203,15 @@ bool FtpUtil::LsDateListingToTime(const string16& month, const string16& day, |
base::Time* result) { |
base::Time::Exploded time_exploded = { 0 }; |
- if (!AbbreviatedMonthToNumber(month, &time_exploded.month)) |
- return false; |
+ if (!AbbreviatedMonthToNumber(month, &time_exploded.month)) { |
+ // Work around garbage sent by some servers in the same column |
+ // as the month. Take just last 3 characters of the string. |
+ if (month.length() < 3 || |
+ !AbbreviatedMonthToNumber(month.substr(month.length() - 3), |
+ &time_exploded.month)) { |
+ return false; |
+ } |
+ } |
if (!base::StringToInt(day, &time_exploded.day_of_month)) |
return false; |