diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-09 08:29:36 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-09 08:29:36 +0000 |
commit | d3d6ea7bdc7595619bbf6a9d9b73a8506322d31a (patch) | |
tree | e981193127eb6dac00ba7b0f1ccc463f49cfcb12 /lib/net/ftp.rb | |
parent | 5f28dda3fef8a8d9b4d2d5cc191dd1b44dd780a5 (diff) | |
download | ruby-d3d6ea7bdc7595619bbf6a9d9b73a8506322d31a.tar.gz |
* lib/net/ftp.rb (parse257): refactor.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/ftp.rb')
-rw-r--r-- | lib/net/ftp.rb | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 2269b750d1..32eef46543 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -1246,24 +1246,7 @@ module Net if !resp.start_with?("257") raise FTPReplyError, resp end - if resp[3, 2] != ' "' - return "" - end - dirname = "" - i = 5 - n = resp.length - while i < n - c = resp[i, 1] - i = i + 1 - if c == '"' - if i > n or resp[i, 1] != '"' - break - end - i = i + 1 - end - dirname = dirname + c - end - return dirname + return resp.slice(/"(([^"]|"")*)"/, 1).to_s.gsub(/""/, '"') end private :parse257 |