Skip to content

Commit

Permalink
Fix wrong number of arguments (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Holtz authored Mar 31, 2021
1 parent b2a05da commit 2a40ef5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/fastlane/plugin/aws_s3/actions/aws_s3_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -520,13 +520,16 @@ def self.upload_files(s3_client, params, s3_region, s3_access_key, s3_secret_acc
app_directory = params[:app_directory]
url_part = s3_path

download_endpoint = params[:download_endpoint]
download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]

Actions.lane_context[SharedValues::S3_FILES_OUTPUT_PATHS] = []
files.each do |file|
file_basename = File.basename(file)
file_data = File.open(file, 'rb')
file_name = url_part + '/' + file_basename

file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption)
file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)

# Setting action and environment variables
Actions.lane_context[SharedValues::S3_FILES_OUTPUT_PATHS] << file_url
Expand All @@ -541,6 +544,9 @@ def self.upload_folder(s3_client, params, s3_region, s3_access_key, s3_secret_ac
url_part = s3_path
app_directory = params[:app_directory]

download_endpoint = params[:download_endpoint]
download_endpoint_replacement_regex = params[:download_endpoint_replacement_regex]

unless File.directory?(folder)
UI.user_error!("Invalid folder parameter. `#{File.expand_path(folder)} is not a directory!")
end
Expand All @@ -551,7 +557,7 @@ def self.upload_folder(s3_client, params, s3_region, s3_access_key, s3_secret_ac
file_relative_path_to_folder = Pathname.new(File.expand_path(file)).relative_path_from(Pathname.new(File.expand_path(folder))).to_s
file_name = url_part + '/' + file_relative_path_to_folder

file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption)
file_url = self.upload_file(s3_client, s3_bucket, app_directory, file_name, file_data, acl, server_side_encryption, download_endpoint, download_endpoint_replacement_regex)
Actions.lane_context[SharedValues::S3_FOLDER_OUTPUT_PATH] = CGI.unescape(file_url).gsub('/' + file_relative_path_to_folder, '')
end
end
Expand Down

0 comments on commit 2a40ef5

Please sign in to comment.