Skip to content

Commit

Permalink
fix: rename file in repository may generate invalid file content
Browse files Browse the repository at this point in the history
  • Loading branch information
amartel committed Jun 25, 2013
1 parent 6093ca1 commit 2d12018
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/webdav_file_resource.rb
Expand Up @@ -506,7 +506,7 @@ def move_to_path(dest_path, depth)
end

#Test if source and destination are in the same repository
if dest_path =~ /^#{svnpath}\//
if svnpath == "" || dest_path =~ /^#{svnpath}\//
if @repository.scm.respond_to?('webdav_move')
@repository.scm.webdav_move(@repository, FileResource.scm_path(@repository, @container.path), FileResource.scm_path(@repository, dest_path[(svnpath.length)..-1]), "moved/renamed #{File.basename(dest_path)}", nil)
end
Expand Down Expand Up @@ -572,7 +572,11 @@ def recurse_copy(dest_path)
root_url = @href.gsub(/#{fpj}/,'').chomp('/')
dest_ress = self.class.new(@project, dest_path, File.join(root_url, dest_path))
if !@isdir
FileResource.write_content_to_path(@project, dest_path, data)
data_to_send = data
if data.kind_of?(File)
data_to_send = data.read
end
FileResource.write_content_to_path(@project, dest_path, data_to_send)
else
if !(dest_ress && dest_ress.valid?)
FileResource.mkcol_for_path(@project, dest_path)
Expand Down

0 comments on commit 2d12018

Please sign in to comment.