7
7
require 'uri'
8
8
9
9
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
+
10
15
# create the directory if it doesn't exist
11
16
dir = File . dirname ( dest )
12
17
unless File . directory? ( dir )
@@ -30,11 +35,16 @@ def download_file(url, dest)
30
35
end
31
36
32
37
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
+
33
43
# only download fonts if the directory doesn't exist or is empty
34
44
unless File . directory? ( dest ) && !Dir . empty? ( dest )
35
45
puts "Downloading fonts from #{ url } to #{ dest } "
36
46
# 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 } " ) )
38
48
doc . css ( 'a' ) . each do |link |
39
49
# get the file name from the url
40
50
file_name = link [ 'href' ] . split ( '/' ) . last . split ( '?' ) . first
@@ -49,6 +59,11 @@ def download_fonts(url, dest)
49
59
end
50
60
51
61
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
+
52
67
# get the file name from the url
53
68
file_name = url . split ( '/' ) . last . split ( '?' ) . first
54
69
0 commit comments