Skip to content
This repository
Browse code

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

fixes #5913
  • Loading branch information...
commit 587de842581fa604564595c58019161f6acc4b1b 1 parent ff3cddf
Juan M. Cuello Juanmcuello authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 activerecord/lib/active_record/railties/databases.rake
4 activerecord/lib/active_record/railties/databases.rake
@@ -387,9 +387,9 @@ db_namespace = namespace :db do
387 387 set_psql_env(abcs[Rails.env])
388 388 search_path = abcs[Rails.env]['schema_search_path']
389 389 unless search_path.blank?
390   - search_path = search_path.split(",").map{|search_path_part| "--schema=#{search_path_part.strip}" }.join(" ")
  390 + search_path = search_path.split(",").map{|search_path_part| "--schema=#{Shellwords.escape(search_path_part.strip)}" }.join(" ")
391 391 end
392   - `pg_dump -i -s -x -O -f #{filename} #{search_path} #{abcs[Rails.env]['database']}`
  392 + `pg_dump -i -s -x -O -f #{Shellwords.escape(filename)} #{search_path} #{Shellwords.escape(abcs[Rails.env]['database'])}`
393 393 raise 'Error dumping database' if $?.exitstatus == 1
394 394 when /sqlite/
395 395 dbfile = abcs[Rails.env]['database']

0 comments on commit 587de84

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