FIX: Prevent double slashes in Ember templates paths (#12630)

Follow-up to https://github.com/discourse/discourse/pull/12517
This commit is contained in:
Osama Sayegh
2021-04-07 14:08:29 +03:00
committed by GitHub
parent 93f74add7d
commit 105634435f
3 changed files with 20 additions and 2 deletions
+5 -1
View File
@@ -183,7 +183,11 @@ class ThemeJavascriptCompiler
# TODO Error handling for handlebars templates
def append_ember_template(name, hbs_template)
name = "javascripts/#{name}" if !name.start_with?("javascripts/")
if !name.start_with?("javascripts/")
prefix = "javascripts"
prefix += "/" if !name.start_with?("/")
name = prefix + name
end
name = name.inspect
compiled = EmberTemplatePrecompiler.new(@theme_id).compile(hbs_template)
# the `'Ember' in window` check is needed for no_ember pages