Trim and things

This commit is contained in:
2019-09-12 21:24:31 +05:30
parent 638fac0ad4
commit 1185904e6c

View File

@@ -30,7 +30,6 @@ app.get('/files/cat',(req,res,next)=>{
//loc //loc
app.post('/files/ls',(req,res,next)=>{ app.post('/files/ls',(req,res,next)=>{
const location = processing.mergedir(req.body.loc,settings) const location = processing.mergedir(req.body.loc,settings)
//const nloc = path.normalize(req.body.loc);
// nloc - Path to show the user // nloc - Path to show the user
const nloc = path.normalize(path.relative(settings.dirname,location)) const nloc = path.normalize(path.relative(settings.dirname,location))
//console.log([loc,nloc]) //console.log([loc,nloc])
@@ -67,8 +66,6 @@ app.post('/files/mv',(req,res,next)=>{
if(processing.inDir(settings.dirname,loc1)&&processing.inDir(settings.dirname,loc2)){ if(processing.inDir(settings.dirname,loc1)&&processing.inDir(settings.dirname,loc2)){
fs.rename(loc1,loc2,err=>{ fs.rename(loc1,loc2,err=>{
if(err){ if(err){
// Enable to watch errors
//console.log(err)
next(err) next(err)
} }
else{ else{
@@ -97,7 +94,6 @@ app.post('/files/upload',(req,res,next)=>{
}) })
req.busboy.on('finish',()=>{ req.busboy.on('finish',()=>{
try{ try{
//console.log(nloc)
// Read // Read
if(nloc.path===null) { if(nloc.path===null) {
throw Error("No path defined") throw Error("No path defined")
@@ -142,7 +138,7 @@ app.listen(settings.port,()=>{
}) })
app.use((err,req,res,next)=>{ app.use((err,req,res,next)=>{
console.log(err.code) console.log("E:"+JSON.stringify(err))
res.status(500).json({error:`Internal error.Try again.`}) res.status(500).json({error:`Internal error.Try again.`})
}) })