Fixed path parsing
This commit is contained in:
parent
baa669db8b
commit
1c75af5349
1 changed files with 3 additions and 3 deletions
|
@ -73,7 +73,7 @@ let formatPost = function(post) {
|
||||||
var cap1 = splitPost[0];
|
var cap1 = splitPost[0];
|
||||||
|
|
||||||
if (cap1 == 'img') {
|
if (cap1 == 'img') {
|
||||||
var matchCleaned = safeName(subPost[1]);
|
var matchCleaned = safePath(splitPost[1]);
|
||||||
splitPost = {'type': 'img', 'url': `/img/${matchCleaned}`};
|
splitPost = {'type': 'img', 'url': `/img/${matchCleaned}`};
|
||||||
|
|
||||||
return splitPost;
|
return splitPost;
|
||||||
|
@ -86,7 +86,6 @@ let formatPost = function(post) {
|
||||||
splitPost = {'type': 'link', 'display': subPost, 'url': `/${type}/${subPostIn}`};
|
splitPost = {'type': 'link', 'display': subPost, 'url': `/${type}/${subPostIn}`};
|
||||||
|
|
||||||
return splitPost;
|
return splitPost;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return subPost;
|
return subPost;
|
||||||
|
@ -102,7 +101,8 @@ let block = function(bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let safePath = function(path) {
|
let safePath = function(path) {
|
||||||
return path.replace(/[^a-zA-Z]+/g, '\\$1')
|
if (path == '..' || path == '.') return '';
|
||||||
|
return path.replace(/[\/]+/g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
Loading…
Reference in a new issue