diff --git a/ChangeLog b/ChangeLog index c6c130351b..02760b1385 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Sep 14 19:26:34 2015 Shugo Maeda + + * lib/net/ftp.rb (parse_mlsx_entry): parse pathnames including + space correctly. + Mon Sep 14 11:12:10 2015 Anton Davydov * lib/racc/rdoc/grammar.en.rdoc: [DOC] fix typo, "convertion" to diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 494cd478b1..fd11acb8b5 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -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 diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb index 711bbab6f7..9fc163bc7b 100644 --- a/test/net/ftp/test_ftp.rb +++ b/test/net/ftp/test_ftp.rb @@ -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"])