From 7b0e373dee81ddd7945cdd1080a11cabdb47a445 Mon Sep 17 00:00:00 2001 From: Vladimir Burdukov Date: Mon, 31 Mar 2014 14:47:27 +0300 Subject: [PATCH 1/2] git.clone method: add shellescape for from string git.download_and_extract_tarball method: add shellescape for all paths update "updates the cache if the ref is not available": add shellescape for git clone arguments --- lib/cocoapods-downloader/git.rb | 4 ++-- spec/git_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cocoapods-downloader/git.rb b/lib/cocoapods-downloader/git.rb index 56fe823..56c25a6 100644 --- a/lib/cocoapods-downloader/git.rb +++ b/lib/cocoapods-downloader/git.rb @@ -64,7 +64,7 @@ def clone_url # def clone(from, to, flags = '') ui_sub_action("Cloning to Pods folder") do - command = %Q|clone #{from} #{to.shellescape}| + command = %Q|clone #{from.shellescape} #{to.shellescape}| command << ' ' + flags if flags git!(command) end @@ -275,7 +275,7 @@ def download_and_extract_tarball(id) tmpfile.write Zlib::GzipReader.new(archive).read end - system "tar xf #{tmpfile.path} -C #{target_path} --strip-components 1" + system "tar xf #{tmpfile.path.shellescape} -C #{target_path.shellescape} --strip-components 1" end end end diff --git a/spec/git_spec.rb b/spec/git_spec.rb index b539dee..32cdf1c 100644 --- a/spec/git_spec.rb +++ b/spec/git_spec.rb @@ -167,7 +167,7 @@ def downloader.execute_command(executable, command, raise_on_failure = false) it "updates the cache if the ref is not available" do # create the origin repo and the cache tmp_repo_path = tmp_folder + 'git-repo-source' - `git clone #{fixture('git-repo')} #{tmp_repo_path}` + `git clone #{fixture('git-repo').shellescape} #{tmp_repo_path.shellescape}` options = { :git => tmp_repo_path, :commit => '7ad3a6c' } downloader = Downloader.for_target(tmp_folder('checkout'), options) downloader.download From 8a217d9eafc9c6ff76d9ab8d933e1f0f36936d2c Mon Sep 17 00:00:00 2001 From: Vladimir Burdukov Date: Mon, 31 Mar 2014 15:36:01 +0300 Subject: [PATCH 2/2] [CHANGELOG] add shellescape for some path arguments in git.rb --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85de081..cdb47ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Master + +###### Enhancements + +* add shellescape for some path arguments in git.rb + [Vladimir Burdukov](https://github.com/chipp) + [#14](https://github.com/CocoaPods/cocoapods-downloader/pull/14) + ## 0.4.0 ###### Enhancements