Commit f9b66aecddb248dcd501419e0ee94fd69fab4de3
1 parent
ad41430c
Exists in
master
and in
4 other branches
Revert "More escaping"
This reverts commit c46eaca91247ccf8e6fb3b691dad028e1b084ae3.
Showing
5 changed files
with
17 additions
and
19 deletions
Show diff stats
lib/backup/database.rb
1 | 1 | require 'yaml' |
2 | -require 'shellwords' | |
3 | 2 | |
4 | 3 | module Backup |
5 | 4 | class Database |
... | ... | @@ -14,20 +13,20 @@ module Backup |
14 | 13 | def dump |
15 | 14 | case config["adapter"] |
16 | 15 | when /^mysql/ then |
17 | - system("mysqldump #{mysql_args} #{Shellwords.shellescape(config['database'])} > #{Shellwords.shellescape(db_file_name)}") | |
16 | + system("mysqldump #{mysql_args} #{config['database']} > #{db_file_name}") | |
18 | 17 | when "postgresql" then |
19 | 18 | pg_env |
20 | - system("pg_dump #{Shellwords.shellescape(config['database'])} > #{db_file_name}") | |
19 | + system("pg_dump #{config['database']} > #{db_file_name}") | |
21 | 20 | end |
22 | 21 | end |
23 | 22 | |
24 | 23 | def restore |
25 | 24 | case config["adapter"] |
26 | 25 | when /^mysql/ then |
27 | - system("mysql #{mysql_args} #{Shellwords.shellescape(config['database'])} < #{db_file_name}") | |
26 | + system("mysql #{mysql_args} #{config['database']} < #{db_file_name}") | |
28 | 27 | when "postgresql" then |
29 | 28 | pg_env |
30 | - system("psql #{Shellwords.shellescape(config['database'])} -f #{Shellwords.shellescape(db_file_name)}") | |
29 | + system("psql #{config['database']} -f #{db_file_name}") | |
31 | 30 | end |
32 | 31 | end |
33 | 32 | |
... | ... | @@ -46,7 +45,7 @@ module Backup |
46 | 45 | 'encoding' => '--default-character-set', |
47 | 46 | 'password' => '--password' |
48 | 47 | } |
49 | - args.map { |opt, arg| "#{arg}=#{Shellwords.shellescape(config[opt])}" if config[opt] }.compact.join(' ') | |
48 | + args.map { |opt, arg| "#{arg}='#{config[opt]}'" if config[opt] }.compact.join(' ') | |
50 | 49 | end |
51 | 50 | |
52 | 51 | def pg_env | ... | ... |
lib/backup/repository.rb
1 | 1 | require 'yaml' |
2 | -require 'shellwords' | |
3 | 2 | |
4 | 3 | module Backup |
5 | 4 | class Repository |
... | ... | @@ -19,7 +18,7 @@ module Backup |
19 | 18 | # Create namespace dir if missing |
20 | 19 | FileUtils.mkdir_p(File.join(backup_repos_path, project.namespace.path)) if project.namespace |
21 | 20 | |
22 | - if system("cd #{Shellwords.shellescape(path_to_repo(project))} > /dev/null 2>&1 && git bundle create #{Shellwords.shellescape(path_to_bundle(project))} --all > /dev/null 2>&1") | |
21 | + if system("cd #{path_to_repo(project)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(project)} --all > /dev/null 2>&1") | |
23 | 22 | puts "[DONE]".green |
24 | 23 | else |
25 | 24 | puts "[FAILED]".red |
... | ... | @@ -31,7 +30,7 @@ module Backup |
31 | 30 | print " * #{wiki.path_with_namespace} ... " |
32 | 31 | if wiki.empty? |
33 | 32 | puts " [SKIPPED]".cyan |
34 | - elsif system("cd #{Shellwords.shellescape(path_to_repo(wiki))} > /dev/null 2>&1 && git bundle create #{Shellwords.shellescape(path_to_bundle(wiki))} --all > /dev/null 2>&1") | |
33 | + elsif system("cd #{path_to_repo(wiki)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(wiki)} --all > /dev/null 2>&1") | |
35 | 34 | puts " [DONE]".green |
36 | 35 | else |
37 | 36 | puts " [FAILED]".red |
... | ... | @@ -54,7 +53,7 @@ module Backup |
54 | 53 | |
55 | 54 | project.namespace.ensure_dir_exist if project.namespace |
56 | 55 | |
57 | - if system("git clone --bare #{Shellwords.shellescape(path_to_bundle(project))} #{Shellwords.shellescape(path_to_repo(project))} > /dev/null 2>&1") | |
56 | + if system("git clone --bare #{path_to_bundle(project)} #{path_to_repo(project)} > /dev/null 2>&1") | |
58 | 57 | puts "[DONE]".green |
59 | 58 | else |
60 | 59 | puts "[FAILED]".red |
... | ... | @@ -64,7 +63,7 @@ module Backup |
64 | 63 | |
65 | 64 | if File.exists?(path_to_bundle(wiki)) |
66 | 65 | print " * #{wiki.path_with_namespace} ... " |
67 | - if system("git clone --bare #{Shellwords.shellescape(path_to_bundle(wiki))} #{Shellwords.shellescape(path_to_repo(wiki))} > /dev/null 2>&1") | |
66 | + if system("git clone --bare #{path_to_bundle(wiki)} #{path_to_repo(wiki)} > /dev/null 2>&1") | |
68 | 67 | puts " [DONE]".green |
69 | 68 | else |
70 | 69 | puts " [FAILED]".red | ... | ... |
spec/models/gollum_wiki_spec.rb
1 | 1 | require "spec_helper" |
2 | -require "shellwords" | |
3 | 2 | |
4 | 3 | describe GollumWiki do |
5 | 4 | |
6 | 5 | def create_temp_repo(path) |
7 | 6 | FileUtils.mkdir_p path |
8 | - system("git init --quiet #{Shellwords.shellescape(path)}") | |
7 | + command = "git init --quiet #{path};" | |
8 | + system(command) | |
9 | 9 | end |
10 | 10 | |
11 | 11 | def remove_temp_repo(path) | ... | ... |
spec/models/wiki_page_spec.rb
1 | 1 | require "spec_helper" |
2 | -require "shellwords" | |
3 | 2 | |
4 | 3 | describe WikiPage do |
5 | 4 | |
6 | 5 | def create_temp_repo(path) |
7 | 6 | FileUtils.mkdir_p path |
8 | - system("git init --quiet #{Shellwords.shellescape(path)}") | |
7 | + command = "git init --quiet #{path};" | |
8 | + system(command) | |
9 | 9 | end |
10 | 10 | |
11 | 11 | def remove_temp_repo(path) | ... | ... |
spec/support/test_env.rb
1 | 1 | require 'rspec/mocks' |
2 | -require 'shellwords' | |
3 | 2 | |
4 | 3 | module TestEnv |
5 | 4 | extend self |
... | ... | @@ -103,7 +102,7 @@ module TestEnv |
103 | 102 | repo = repo(namespace, name) |
104 | 103 | |
105 | 104 | # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq |
106 | - system("ln -s -f #{Shellwords.shellescape(seed_repo_path())} #{Shellwords.shellescape(repo)}") | |
105 | + system("ln -s -f #{seed_repo_path()} #{repo}") | |
107 | 106 | create_satellite(repo, namespace, name) |
108 | 107 | end |
109 | 108 | |
... | ... | @@ -167,11 +166,12 @@ module TestEnv |
167 | 166 | # Symlink tmp/satellite/gitlabhq to tmp/test-git-base-path/satellite/gitlabhq, create the directory if it doesn't exist already |
168 | 167 | satellite_dir = File.dirname(satellite_repo) |
169 | 168 | FileUtils.mkdir_p(satellite_dir) unless File.exists?(satellite_dir) |
170 | - system("ln -s -f #{Shellwords.shellescape(seed_satellite_path)} #{Shellwords.shellescape(satellite_repo)}") | |
169 | + system("ln -s -f #{seed_satellite_path} #{satellite_repo}") | |
171 | 170 | end |
172 | 171 | |
173 | 172 | def create_temp_repo(path) |
174 | 173 | FileUtils.mkdir_p path |
175 | - system("git init --quiet --bare #{Shellwords.shellescape(path)}") | |
174 | + command = "git init --quiet --bare #{path};" | |
175 | + system(command) | |
176 | 176 | end |
177 | 177 | end | ... | ... |