From b619cebda1893a71bfe074281f98a2fe65191100 Mon Sep 17 00:00:00 2001 From: Alexandre CANTIN Date: Sun, 23 Feb 2020 05:37:21 +0100 Subject: [PATCH] site: fix loading REPL with filename containing multiple '.'s (#4441) --- site/src/routes/repl/[id]/index.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site/src/routes/repl/[id]/index.svelte b/site/src/routes/repl/[id]/index.svelte index 4d05ac28ea..b237e19967 100644 --- a/site/src/routes/repl/[id]/index.svelte +++ b/site/src/routes/repl/[id]/index.svelte @@ -57,7 +57,10 @@ is_relaxed_gist = data.relaxed; const components = data.files.map(file => { - let [name, type] = file.name.split('.'); + const dot = file.name.lastIndexOf("."); + let name = file.name.slice(0, dot); + let type = file.name.slice(dot + 1); + if (type === 'html') type = 'svelte'; // TODO do this on the server return { name, type, source: file.source }; });