From 000995bc8630ac713b7c600ea7029ad47b32763a Mon Sep 17 00:00:00 2001 From: George <31376482+george-gca@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:29:54 -0300 Subject: [PATCH] Fix code scanning alert no. 11: Use of `Kernel.open` or `IO.read` 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> --- _plugins/download-3rd-party.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_plugins/download-3rd-party.rb b/_plugins/download-3rd-party.rb index 1bd1a6d33bfe..5db8ecc9bc0e 100644 --- a/_plugins/download-3rd-party.rb +++ b/_plugins/download-3rd-party.rb @@ -92,7 +92,7 @@ def download_fonts(url, dest, file_types) unless File.directory?(dest) && !Dir.empty?(dest) puts "Downloading fonts from #{url} to #{dest}" # get available fonts from the url - doc = Nokogiri::HTML(URI.open(url, "User-Agent" => "Ruby/#{RUBY_VERSION}")) + doc = Nokogiri::HTML(URI(url).open("User-Agent" => "Ruby/#{RUBY_VERSION}")) doc.css('a').each do |link| # get the file name from the url file_name = link['href'].split('/').last.split('?').first @@ -116,7 +116,7 @@ def download_images(url, dest, file_types) unless File.directory?(dest) && !Dir.empty?(dest) puts "Downloading images from #{url} to #{dest}" # get available fonts from the url - doc = Nokogiri::HTML(URI.open(url, "User-Agent" => "Ruby/#{RUBY_VERSION}")) + doc = Nokogiri::HTML(URI(url).open("User-Agent" => "Ruby/#{RUBY_VERSION}")) doc.xpath('/html/body/div/div[3]/table/tbody/tr/td[1]/a').each do |link| # get the file name from the url file_name = link['href'].split('/').last.split('?').first