Skip to content

Commit

Permalink
improve url building for dump filename
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Oct 15, 2018
1 parent 28a79ac commit 689c08f
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/evm_database_ops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,14 @@ def self.restore(db_opts, connect_opts = {})
connect_opts[:uri] = File.dirname(connect_opts[:uri])
else
connect_opts[:remote_file_name] ||= File.basename(backup_file_name(action))
backup_folder = if connect_opts[:skip_directory]
[]
elsif action == :dump
"db_dump"
else
"db_backup"
end
#
# If the passed in URI contains query parameters, ignore them
# when creating the dump file name. They'll be used in the session object.
#
connect_opts_uri = connect_opts[:uri].split('?')[0]
uri = File.join(connect_opts_uri, backup_folder, connect_opts[:remote_file_name])
uri_parts = [connect_opts[:uri].split('?')[0]]
uri_parts << (action == :dump ? "db_dump" : "db_backup") unless connect_opts[:skip_directory]
uri_parts << connect_opts[:remote_file_name]
uri = File.join(uri_parts)
end
else
uri = db_opts[:local_file]
Expand Down

0 comments on commit 689c08f

Please sign in to comment.