From 1c75af534919f0236cc49ce67bf032c81b1b01a3 Mon Sep 17 00:00:00 2001 From: Xodrium <118943715+malloc62@users.noreply.github.com> Date: Sun, 12 Feb 2023 01:57:20 -0500 Subject: [PATCH] Fixed path parsing --- src/lib/util.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/util.js b/src/lib/util.js index 167e110..cc2d79b 100644 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -73,7 +73,7 @@ let formatPost = function(post) { var cap1 = splitPost[0]; if (cap1 == 'img') { - var matchCleaned = safeName(subPost[1]); + var matchCleaned = safePath(splitPost[1]); splitPost = {'type': 'img', 'url': `/img/${matchCleaned}`}; return splitPost; @@ -86,7 +86,6 @@ let formatPost = function(post) { splitPost = {'type': 'link', 'display': subPost, 'url': `/${type}/${subPostIn}`}; return splitPost; - } return subPost; @@ -102,7 +101,8 @@ let block = function(bool) { } let safePath = function(path) { - return path.replace(/[^a-zA-Z]+/g, '\\$1') + if (path == '..' || path == '.') return ''; + return path.replace(/[\/]+/g, '') } export {