Skip to content

Commit 628d59f

Browse files
george-gcaTeusner
authored andcommitted
Security fixes for download-3rd-party.rb
1 parent d1ef184 commit 628d59f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_plugins/download-3rd-party.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def download_file(url, dest)
7070
unless File.file?(dest)
7171
puts "Downloading #{url} to #{dest}"
7272
File.open(dest, "wb") do |saved_file|
73-
URI.open(url, "rb") do |read_file|
73+
URI(url).open("rb") do |read_file|
7474
saved_file.write(read_file.read)
7575
end
7676
end
@@ -148,7 +148,7 @@ def download_fonts_from_css(config, url, dest, lib_name, file_types)
148148
puts "Downloading fonts from #{url} to #{dest}"
149149
# download the css file with a fake user agent to force downloading woff2 fonts instead of ttf
150150
# user agent from https://www.whatismybrowser.com/guides/the-latest-user-agent/chrome
151-
doc = Nokogiri::HTML(URI.open(url, "User-Agent" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"))
151+
doc = Nokogiri::HTML(URI(url).open("User-Agent" => "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"))
152152
css = CssParser::Parser.new
153153
css.load_string! doc.document.text
154154

0 commit comments

Comments
 (0)