Since absolute paths on Windows do not always start with /, we need to
make sure that there is always a slash between the checksum and the
path, or the drive letter will end up being considered as part of the
checksum.

On systems where absolute paths always start with /, the extra slash
is removed by the parsing done to the constructed URL.

Reviewed-by: Nick Lewis <[email protected]>
Signed-off-by: Jacob Helwig <[email protected]>
---
 lib/puppet/file_bucket/dipper.rb     |    5 +++--
 spec/unit/file_bucket/dipper_spec.rb |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb
index d6f6a37..870c50e 100644
--- a/lib/puppet/file_bucket/dipper.rb
+++ b/lib/puppet/file_bucket/dipper.rb
@@ -35,11 +35,12 @@ class Puppet::FileBucket::Dipper
     begin
       file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path 
=> @local_path)
       files_original_path = absolutize_path(file)
-      dest_path = "#{@rest_path}#{file_bucket_file.name}#{files_original_path}"
+      dest_path = 
"#{@rest_path}#{file_bucket_file.name}/#{files_original_path}"
+      file_bucket_path = 
"#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}/#{files_original_path}"
 
       # Make a HEAD request for the file so that we don't waste time
       # uploading it if it already exists in the bucket.
-      unless 
Puppet::FileBucket::File.indirection.head("#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}#{files_original_path}")
+      unless Puppet::FileBucket::File.indirection.head(file_bucket_path)
         Puppet::FileBucket::File.indirection.save(file_bucket_file, dest_path)
       end
 
diff --git a/spec/unit/file_bucket/dipper_spec.rb 
b/spec/unit/file_bucket/dipper_spec.rb
index 431b123..6057193 100755
--- a/spec/unit/file_bucket/dipper_spec.rb
+++ b/spec/unit/file_bucket/dipper_spec.rb
@@ -91,7 +91,7 @@ describe Puppet::FileBucket::Dipper do
     [request1, request2].each do |r|
       r.server.should == 'puppetmaster'
       r.port.should == 31337
-      r.key.should == "md5/#{checksum}#{real_path}"
+      r.key.should == "md5/#{checksum}/#{real_path}"
     end
   end
 
-- 
1.7.6

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to