From 195cf17c3c58ac9c31aefda04ad36c8b79b2d51b Mon Sep 17 00:00:00 2001 From: Alexan Date: Fri, 21 Feb 2020 18:08:51 +0100 Subject: [PATCH] repl: multiple dots in filename not supported when reloading a saved project In REPL, if you reload a saved project with a file containing multiple dots (example.store.js), the file will be reload as 'example.store' and imports will break. --- 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 }; });