summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-12 09:16:21 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-12 09:16:21 +0000
commit777c719450311f27d1cf67ef0afc60c953cefe9d (patch)
tree010b14c563f148ed4b0b9acaa5990dbe59b9f2ae /lib
parent8bb056a8c29735fea0a7d1c8ddfd6276befa6609 (diff)
* lib/net/ftp.rb (parse_mlsx_entry, mlst) raise an FTPProtoError
when parsing failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ftp.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 8bd309b21a..f4f7494a04 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -795,6 +795,9 @@ module Net
def parse_mlsx_entry(entry)
facts, pathname = entry.split(" ")
+ unless pathname
+ raise FTPProtoError, entry
+ end
return MLSxEntry.new(
facts.scan(/(.*?)=(.*?);/).each_with_object({}) {
|(factname, value), h|
@@ -816,7 +819,11 @@ module Net
if !resp.start_with?("250")
raise FTPReplyError, resp
end
- entry = resp.lines[1].sub(/\A(250-| *)/, "")
+ line = resp.lines[1]
+ unless line
+ raise FTPProtoError, resp
+ end
+ entry = line.sub(/\A(250-| *)/, "")
return parse_mlsx_entry(entry)
end