From 04ad3cc5e0a5b0d02e6d81318950f827e2457788 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Wed, 19 May 2021 15:10:32 +0100 Subject: [PATCH] Sanitize filename when publishing gist folder --- libs/remix-ui/file-explorer/src/lib/file-explorer.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx index b2350902e6..65b6f2337b 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer.tsx @@ -930,6 +930,11 @@ async function packageFiles (filesProvider, directory, callback) { if (/^\s+$/.test(content) || !content.length) { content = '// this line is added to create a gist. Empty file is not allowed.' } + if (path.indexOf('gist-') === 0) { + path = path.split('/') + path.shift() + path = path.join('/') + } path = path.replace(/\//g, '...') ret[path] = { content } })