From 1103fd2bcd4af2496c742e1c33ae92e290e22ee9 Mon Sep 17 00:00:00 2001 From: Christopher Rose Date: Sat, 14 Sep 2019 13:31:24 +0530 Subject: [PATCH] Fix directory traversing --- static/base.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/static/base.js b/static/base.js index 0261833..d4c26fb 100644 --- a/static/base.js +++ b/static/base.js @@ -40,12 +40,15 @@ async function postMV(oldLocation,newLocation){ } +///Call for onclick of elements function doUpdate(ele,isDir=false){ console.log(ele.attr('data-choice')) + ///Check if succeeds postLS(ele.attr('data-choice')).then(e=>{ if(ele.hasClass('file-isDir')){ + ///Set as current directory currDir.loc=ele.attr('data-choice') - postLS(currDir.loc); + updateContents(e) } if(!isDir){ currSel.loc = ele.attr('data-choice') @@ -54,11 +57,13 @@ function doUpdate(ele,isDir=false){ }, err=>{ console.log(`E:Something went wrong: ${JSON.stringify(err)}`) - }) + }).finally() } + +///Populate contents function updateContents(contentResponse){ - // Change top header contents + ///Change top header contents $('#files-location').html(contentResponse.loc) // if empty, return null, this shouldnt execute if the server is responding properly but ok