mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FIX: Empty backup names with unicode site titles
If a site title contains unicode it may end up with an empty backup filename because of the rails `parameterize` method we are calling. This fix ensures that the backup filenames default to "discourse" if the parameterized site title is empty. Bug reported [here][1]. [1]: https://meta.discourse.org/t/backup-checksum-and-backup-name-missing-when-unicode-site-name/123192?u=blake
This commit is contained in:
19
spec/lib/backup_restore/backuper_spec.rb
Normal file
19
spec/lib/backup_restore/backuper_spec.rb
Normal file
@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe BackupRestore::Backuper do
|
||||
it 'returns a non-empty parameterized title when site title contains unicode' do
|
||||
SiteSetting.title = 'Ɣ'
|
||||
backuper = BackupRestore::Backuper.new(-1)
|
||||
|
||||
expect(backuper.send(:get_parameterized_title)).to eq("discourse")
|
||||
end
|
||||
|
||||
it 'returns a valid parameterized site title' do
|
||||
SiteSetting.title = "Coding Horror"
|
||||
backuper = BackupRestore::Backuper.new(-1)
|
||||
|
||||
expect(backuper.send(:get_parameterized_title)).to eq("coding-horror")
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user