Sanitize filename when publishing gist folder

pull/5370/head
ioedeveloper 4 years ago
parent 2a8240f8c0
commit 3780deae48
  1. 5
      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) { if (/^\s+$/.test(content) || !content.length) {
content = '// this line is added to create a gist. Empty file is not allowed.' 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, '...') path = path.replace(/\//g, '...')
ret[path] = { content } ret[path] = { content }
}) })

Loading…
Cancel
Save