From e3221616187150b588d5f6afd1347afa3a909100 Mon Sep 17 00:00:00 2001 From: luke Date: Mon, 21 Aug 2006 23:02:56 +0000 Subject: Fixing #225. Normal file copying worked with spaces, but recursive file copying did not. I modified one of the support methods so it works now. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1478 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/server/fileserver.rb | 2 +- test/types/filesources.rb | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/puppet/server/fileserver.rb b/lib/puppet/server/fileserver.rb index e3b7d8f3a..7e0e49105 100755 --- a/lib/puppet/server/fileserver.rb +++ b/lib/puppet/server/fileserver.rb @@ -343,7 +343,7 @@ class Server # Note that the user could have passed a path with multiple /'s # in it, and we are likely to result in multiples, so we have to # get rid of all of them. - name.sub(/\/#{mount.name}/, mount.path).gsub(%r{/+}, '/').sub( + CGI.unescape name.sub(/\/#{mount.name}/, mount.path).gsub(%r{/+}, '/').sub( %r{/$}, '' ) end diff --git a/test/types/filesources.rb b/test/types/filesources.rb index 8c1d40b6f..fa4d015ab 100755 --- a/test/types/filesources.rb +++ b/test/types/filesources.rb @@ -585,6 +585,28 @@ class TestFileSources < Test::Unit::TestCase assert_equal(File.read(source), File.read(dest), "Files are not equal") assert_events([], obj) end + + def test_file_source_with_space + dir = tempfile() + source = File.join(dir, "file with spaces") + Dir.mkdir(dir) + File.open(source, "w") { |f| f.puts "yayness" } + + newdir = tempfile() + newpath = File.join(newdir, "file with spaces") + + file = Puppet::Type.newfile( + :path => newdir, + :source => dir, + :recurse => true + ) + + + assert_apply(file) + + assert(FileTest.exists?(newpath), "Did not create file") + assert_equal("yayness\n", File.read(newpath)) + end end # $Id$ -- cgit