Merge pull request #6141 from chrmoritz/unpackDir
fix copying top level symlinks to folders in directory unpack_strategy
This commit is contained in:
commit
e098c37dc3
@ -9,6 +9,8 @@ describe UnpackStrategy::Directory do
|
||||
mktmpdir.tap do |path|
|
||||
FileUtils.touch path/"file"
|
||||
FileUtils.ln_s "file", path/"symlink"
|
||||
FileUtils.mkdir path/"folder"
|
||||
FileUtils.ln_s "folder", path/"folderSymlink"
|
||||
end
|
||||
}
|
||||
|
||||
@ -19,6 +21,11 @@ describe UnpackStrategy::Directory do
|
||||
expect(unpack_dir/"symlink").to be_a_symlink
|
||||
end
|
||||
|
||||
it "does not follow top level symlinks to directories" do
|
||||
strategy.extract(to: unpack_dir)
|
||||
expect(unpack_dir/"folderSymlink").to be_a_symlink
|
||||
end
|
||||
|
||||
it "preserves permissions of contained files" do
|
||||
FileUtils.chmod 0644, path/"file"
|
||||
|
||||
|
||||
@ -19,7 +19,8 @@ module UnpackStrategy
|
||||
def extract_to_dir(unpack_dir, basename:, verbose:)
|
||||
path.children.each do |child|
|
||||
system_command! "cp",
|
||||
args: ["-pR", child.directory? ? "#{child}/." : child, unpack_dir/child.basename],
|
||||
args: ["-pR", (child.directory? && !child.symlink?) ? "#{child}/." : child,
|
||||
unpack_dir/child.basename],
|
||||
verbose: verbose
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user