diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-21 23:02:56 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-21 23:02:56 +0000 |
commit | e3221616187150b588d5f6afd1347afa3a909100 (patch) | |
tree | d4563bd578cf46a541bf21ec3a37b47da2f13194 | |
parent | bf43c76deddb8475fea43515ebd530b5d3f331a2 (diff) | |
download | puppet-e3221616187150b588d5f6afd1347afa3a909100.tar.gz puppet-e3221616187150b588d5f6afd1347afa3a909100.tar.xz puppet-e3221616187150b588d5f6afd1347afa3a909100.zip |
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
-rwxr-xr-x | lib/puppet/server/fileserver.rb | 2 | ||||
-rwxr-xr-x | test/types/filesources.rb | 22 |
2 files changed, 23 insertions, 1 deletions
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$ |