Skip to content
Browse files

Use Shellwords to scape arguments in db:structure:dump for PostgreSQL.

fixes #5913
  • Loading branch information...
1 parent ff3cddf commit 587de842581fa604564595c58019161f6acc4b1b @Juanmcuello Juanmcuello committed Apr 21, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/railties/databases.rake
View
4 activerecord/lib/active_record/railties/databases.rake
@@ -387,9 +387,9 @@ db_namespace = namespace :db do
set_psql_env(abcs[Rails.env])
search_path = abcs[Rails.env]['schema_search_path']
unless search_path.blank?
- search_path = search_path.split(",").map{|search_path_part| "--schema=#{search_path_part.strip}" }.join(" ")
+ search_path = search_path.split(",").map{|search_path_part| "--schema=#{Shellwords.escape(search_path_part.strip)}" }.join(" ")
end
- `pg_dump -i -s -x -O -f #{filename} #{search_path} #{abcs[Rails.env]['database']}`
+ `pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(abcs[Rails.env]['database'])}`
raise 'Error dumping database' if $?.exitstatus == 1
when /sqlite/
dbfile = abcs[Rails.env]['database']

0 comments on commit 587de84

Please sign in to comment.
Something went wrong with that request. Please try again.