1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/ftp.rb (parse_mlsx_entry): parse pathnames including

space correctly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2015-09-14 10:27:28 +00:00
parent cb1ff236f5
commit 5425099a9f
3 changed files with 8 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Mon Sep 14 19:26:34 2015 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/ftp.rb (parse_mlsx_entry): parse pathnames including
space correctly.
Mon Sep 14 11:12:10 2015 Anton Davydov <antondavydov.o@gmail.com>
* lib/racc/rdoc/grammar.en.rdoc: [DOC] fix typo, "convertion" to

View file

@ -914,7 +914,7 @@ module Net
FACT_PARSERS["unix.atime"] = TIME_PARSER
def parse_mlsx_entry(entry)
facts, pathname = entry.split(" ")
facts, pathname = entry.chomp.split(/ /, 2)
unless pathname
raise FTPProtoError, entry
end

View file

@ -1191,7 +1191,7 @@ EOF
def test_mlsd
commands = []
entry_lines = [
"Type=file;Unique=FC00U1E554A;Size=1234567;Modify=20131220035929.123456;Perm=r; foo",
"Type=file;Unique=FC00U1E554A;Size=1234567;Modify=20131220035929.123456;Perm=r; foo bar",
"Type=cdir;Unique=FC00U1E554B;Modify=20131220035929;Perm=flcdmpe; .",
"Type=pdir;Unique=FC00U1E554C;Modify=20131220035929;Perm=flcdmpe; ..",
]
@ -1237,7 +1237,7 @@ EOF
assert_equal("TYPE I\r\n", commands.shift)
entries = ftp.mlsd("/")
assert_equal(3, entries.size)
assert_equal("foo", entries[0].pathname)
assert_equal("foo bar", entries[0].pathname)
assert_equal(".", entries[1].pathname)
assert_equal("..", entries[2].pathname)
assert_equal("file", entries[0].facts["type"])