summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-21 23:02:56 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-08-21 23:02:56 +0000
commite3221616187150b588d5f6afd1347afa3a909100 (patch)
treed4563bd578cf46a541bf21ec3a37b47da2f13194
parentbf43c76deddb8475fea43515ebd530b5d3f331a2 (diff)
downloadpuppet-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-xlib/puppet/server/fileserver.rb2
-rwxr-xr-xtest/types/filesources.rb22
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$