77 require 'uri'
88
99 def download_file ( url , dest )
10+ # only try to download the file if url doesn't start with | for security reasons
11+ if url . start_with? ( '|' )
12+ return
13+ end
14+
1015 # create the directory if it doesn't exist
1116 dir = File . dirname ( dest )
1217 unless File . directory? ( dir )
@@ -30,11 +35,16 @@ def download_file(url, dest)
3035 end
3136
3237 def download_fonts ( url , dest )
38+ # only try to download the file if url doesn't start with | for security reasons
39+ if url . start_with? ( '|' )
40+ return
41+ end
42+
3343 # only download fonts if the directory doesn't exist or is empty
3444 unless File . directory? ( dest ) && !Dir . empty? ( dest )
3545 puts "Downloading fonts from #{ url } to #{ dest } "
3646 # get available fonts from the url
37- doc = Nokogiri ::HTML ( URI ( ) . open ( url , "User-Agent" => "Ruby/#{ RUBY_VERSION } " ) )
47+ doc = Nokogiri ::HTML ( URI . open ( url , "User-Agent" => "Ruby/#{ RUBY_VERSION } " ) )
3848 doc . css ( 'a' ) . each do |link |
3949 # get the file name from the url
4050 file_name = link [ 'href' ] . split ( '/' ) . last . split ( '?' ) . first
@@ -49,6 +59,11 @@ def download_fonts(url, dest)
4959 end
5060
5161 def download_fonts_from_css ( config , url , dest )
62+ # only try to download the file if url doesn't start with | for security reasons
63+ if url . start_with? ( '|' )
64+ return
65+ end
66+
5267 # get the file name from the url
5368 file_name = url . split ( '/' ) . last . split ( '?' ) . first
5469
0 commit comments