FIX: truncate extremely long site name titles (#30977)
This corrects an issue where very long titles on website would cause the backup not to save cause filename was too long
This commit is contained in:
parent
8d45755a06
commit
8be16c997e
|
@ -75,7 +75,7 @@ module BackupRestore
|
|||
end
|
||||
|
||||
def get_parameterized_title
|
||||
SiteSetting.title.parameterize.presence || "discourse"
|
||||
SiteSetting.title.parameterize[...64].presence || "discourse"
|
||||
end
|
||||
|
||||
def initialize_state
|
||||
|
|
|
@ -9,6 +9,13 @@ RSpec.describe BackupRestore::Backuper do
|
|||
expect(backuper.send(:get_parameterized_title)).to eq("discourse")
|
||||
end
|
||||
|
||||
it "truncates the title to 64 chars" do
|
||||
SiteSetting.title = "This is th title of a very long site that is going to be truncated"
|
||||
backuper = BackupRestore::Backuper.new(Discourse.system_user.id)
|
||||
|
||||
expect(backuper.send(:get_parameterized_title).length).to eq(64)
|
||||
end
|
||||
|
||||
it "returns a valid parameterized site title" do
|
||||
SiteSetting.title = "Coding Horror"
|
||||
backuper = BackupRestore::Backuper.new(Discourse.system_user.id)
|
||||
|
|
Loading…
Reference in New Issue