FIX: don't break the private key when writing it out during theme import

* when importing a private theme using the themes:install rake task the SSH key is written out to a file for use by the git-clone command
* if the private key is written out without a newline at end-of-file (i.e. after it's been stripped) it's not recognized as a valid key by SSH
* so: don't strip it when writing it out, we should be fine
This commit is contained in:
Michael Brown 2020-03-10 13:20:11 -04:00
parent 3f2c0b42fe
commit 74acbad505
No known key found for this signature in database
GPG Key ID: 6C07FB3007CF9360
1 changed files with 1 additions and 1 deletions

View File

@ -107,7 +107,7 @@ class ThemeStore::GitImporter
ssh_folder = "#{Pathname.new(Dir.tmpdir).realpath}/discourse_theme_ssh_#{SecureRandom.hex}" ssh_folder = "#{Pathname.new(Dir.tmpdir).realpath}/discourse_theme_ssh_#{SecureRandom.hex}"
FileUtils.mkdir_p ssh_folder FileUtils.mkdir_p ssh_folder
File.write("#{ssh_folder}/id_rsa", @private_key.strip) File.write("#{ssh_folder}/id_rsa", @private_key)
FileUtils.chmod(0600, "#{ssh_folder}/id_rsa") FileUtils.chmod(0600, "#{ssh_folder}/id_rsa")
begin begin