Skip to content
This repository
Browse code

Merge pull request #5925 from Juanmcuello/pg_structure_dump

Quote arguments in db:structure:dump for PostgreSQL.
  • Loading branch information...
commit a9af9f10cb841ed1c2f51c7990cef76297b15e39 2 parents 356f2a6 + 587de84
Carlos Antonio da Silva authored May 24, 2012
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 notes on commit a9af9f1

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