Skip to content

Commit 84f8eef

Browse files
committed
quote parameters to shell command
1 parent 1d3b281 commit 84f8eef

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

helper/download-helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'shellwords'
2+
13
module ViddlRb
24

35
class RequirementError < StandardError; end
@@ -23,14 +25,20 @@ def get_command(download_url, save_path)
2325
TOOLS_PRIORITY_LIST = [
2426

2527
Tool.new(:aria2c) do |url, path|
28+
url = Shellwords.escape(url)
29+
path = Shellwords.escape(url)
2630
"aria2c #{url.inspect} -U 'Wget/1.8.1' -x4 -d #{File.dirname(path).inspect} -o #{File.basename(path).inspect}"
2731
end,
2832

2933
Tool.new(:wget) do |url, path|
34+
url = Shellwords.escape(url)
35+
path = Shellwords.escape(url)
3036
"wget -c #{url.inspect} -O #{path.inspect}"
3137
end,
3238

3339
Tool.new(:curl) do |url, path|
40+
url = Shellwords.escape(url)
41+
path = Shellwords.escape(url)
3442
"curl -A 'Wget/1.8.1' --retry 10 --retry-delay 5 --retry-max-time 4 -L #{url.inspect} -o #{path.inspect}"
3543
end
3644
]

0 commit comments

Comments
 (0)