Skip to content

Commit

Permalink
Fix code scanning alert fastlane#89: Use of Kernel.open or `IO.read…
Browse files Browse the repository at this point in the history
…` or similar sinks with a non-constant value

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
art-tykh and github-advanced-security[bot] authored Sep 19, 2024
1 parent 1098fab commit 4565bb9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions deliver/lib/deliver/download_screenshots.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative 'module'
require 'spaceship'
require 'open-uri'
require 'net/http'

module Deliver
class DownloadScreenshots
Expand Down Expand Up @@ -68,9 +68,15 @@ def self.download_screenshots(folder_path, localization)
end

path = File.join(containing_folder, file_name)
File.binwrite(path, URI.open(url).read)
File.binwrite(path, fetch_url_content(url))
end
end
end
def self.fetch_url_content(url)
uri = URI(url)
response = Net::HTTP.get_response(uri)
raise "Failed to fetch URL: #{url}" unless response.is_a?(Net::HTTPSuccess)
response.body
end
end
end

0 comments on commit 4565bb9

Please sign in to comment.