ruby-changes:39775
From: shugo <ko1@a...>
Date: Mon, 14 Sep 2015 19:27:38 +0900 (JST)
Subject: [ruby-changes:39775] shugo:r51856 (trunk): * lib/net/ftp.rb (parse_mlsx_entry): parse pathnames including
shugo 2015-09-14 19:27:28 +0900 (Mon, 14 Sep 2015) New Revision: 51856 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51856 Log: * lib/net/ftp.rb (parse_mlsx_entry): parse pathnames including space correctly. Modified files: trunk/ChangeLog trunk/lib/net/ftp.rb trunk/test/net/ftp/test_ftp.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 51855) +++ ChangeLog (revision 51856) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Sep 14 19:26:34 2015 Shugo Maeda <shugo@r...> + + * lib/net/ftp.rb (parse_mlsx_entry): parse pathnames including + space correctly. + Mon Sep 14 11:12:10 2015 Anton Davydov <antondavydov.o@g...> * lib/racc/rdoc/grammar.en.rdoc: [DOC] fix typo, "convertion" to Index: lib/net/ftp.rb =================================================================== --- lib/net/ftp.rb (revision 51855) +++ lib/net/ftp.rb (revision 51856) @@ -914,7 +914,7 @@ module Net https://github.com/ruby/ruby/blob/trunk/lib/net/ftp.rb#L914 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 Index: test/net/ftp/test_ftp.rb =================================================================== --- test/net/ftp/test_ftp.rb (revision 51855) +++ test/net/ftp/test_ftp.rb (revision 51856) @@ -1191,7 +1191,7 @@ EOF https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1191 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 https://github.com/ruby/ruby/blob/trunk/test/net/ftp/test_ftp.rb#L1237 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"]) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/