From 300b8090d922f142cea6d7e43d766f6ac29b6404 Mon Sep 17 00:00:00 2001 From: Bartosz Polaczyk Date: Wed, 9 Aug 2023 15:19:06 +0200 Subject: [PATCH 1/2] Fix URI.open --- .../lib/cocoapods-xcremotecache/command/hooks.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb index 3b43d96d..9d8fa05e 100644 --- a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb +++ b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb @@ -18,6 +18,7 @@ require 'yaml' require 'json' require 'pathname' +require 'fileutils' module CocoapodsXCRemoteCacheModifier @@ -295,11 +296,11 @@ def self.download_latest_xcrc_release(local_package_location) throw "Downloading XCRemoteCache failed" end - URI.open(asset_url, "accept" => 'application/octet-stream') do |f| - File.open(local_package_location, "wb") do |file| - file.puts f.read - end - end + uri = URI(asset_url) + options = { 'accept' => 'application/octet-stream' } + # File is > 10KB so Tempfile will be returned + downloaded_file = uri.open(options) + FileUtils.cp(downloaded_file, local_package_location) end def self.add_cflags!(options, key, value, exclude_sdks_configurations) From 71735b387724e108bec16ae1e0a7b0444d17e9b6 Mon Sep 17 00:00:00 2001 From: Bartosz Polaczyk Date: Wed, 9 Aug 2023 15:21:23 +0200 Subject: [PATCH 2/2] Fix system call --- cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb index 9d8fa05e..a4431d18 100644 --- a/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb +++ b/cocoapods-plugin/lib/cocoapods-xcremotecache/command/hooks.rb @@ -276,7 +276,7 @@ def self.download_xcrc_if_needed(local_location) download_latest_xcrc_release(local_package_location) - if !system("unzip #{local_package_location} -d #{local_location}") + if !system("unzip", local_package_location, "-d", local_location) throw "Unzipping XCRemoteCache failed" end end