summaryrefslogtreecommitdiffstats
path: root/net/ftp/ftp_network_transaction.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/ftp/ftp_network_transaction.cc')
-rw-r--r--net/ftp/ftp_network_transaction.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 02e4be0..295754d 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -977,8 +977,14 @@ int FtpNetworkTransaction::ProcessResponseSIZE(
return Stop(ERR_INVALID_RESPONSE);
if (size < 0)
return Stop(ERR_INVALID_RESPONSE);
- response_.expected_content_size = size;
- resource_type_ = RESOURCE_TYPE_FILE;
+
+ // Some FTP servers respond with success to the SIZE command
+ // for directories, and return 0 size. Make sure we don't set
+ // the resource type to file if that's the case.
+ if (size > 0) {
+ response_.expected_content_size = size;
+ resource_type_ = RESOURCE_TYPE_FILE;
+ }
break;
case ERROR_CLASS_INFO_NEEDED:
break;