UX: Do not prepend discourse to theme filename if it's already there

This commit is contained in:
David Taylor
2019-01-28 11:29:29 +00:00
parent aca0b32fda
commit 99e0820c0b
2 changed files with 10 additions and 1 deletions

View File

@@ -5,7 +5,8 @@ class ThemeStore::TgzExporter
def initialize(theme)
@theme = theme
@temp_folder = "#{Pathname.new(Dir.tmpdir).realpath}/discourse_theme_#{SecureRandom.hex}"
@export_name = "discourse-#{@theme.name.downcase.gsub(/[^0-9a-z.\-]/, '-')}-theme"
@export_name = "#{@theme.name.downcase.gsub(/[^0-9a-z.\-]/, '-')}-theme"
@export_name = "discourse-#{@export_name}" unless @export_name.starts_with?("discourse")
end
def package_filename