fix: asset path traversal on windows

This commit is contained in:
NGPixel 2021-12-03 22:30:22 -05:00
parent 112d070730
commit 414033de9d
No known key found for this signature in database
GPG Key ID: 8FDA2F1757F60D63

View File

@ -35,6 +35,8 @@ module.exports = {
rawPath = rawPath.replace(unsafeCharsRegex, '')
if (rawPath === '') { rawPath = 'home' }
rawPath = rawPath.replaceAll('\\', '').replaceAll('//', '').replaceAll(/\.\.+/ig, '')
// Extract Info
let pathParts = _.filter(_.split(rawPath, '/'), p => {
p = _.trim(p)