From 9845df4d1b6805b516bd76e325e8829f9ce1d68c Mon Sep 17 00:00:00 2001 From: Baris Usakli Date: Mon, 9 Sep 2013 15:09:05 -0400 Subject: [PATCH] another fix to path in image upload --- src/routes/user.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/user.js b/src/routes/user.js index be7deb457e..7f7e00cbf5 100644 --- a/src/routes/user.js +++ b/src/routes/user.js @@ -131,11 +131,11 @@ var user = require('./../user.js'), return; } - var absolutePath = path.join(__dirname, '../', global.nconf.get('upload_path'), path.basename(oldpicture)); + var absolutePath = path.join(process.cwd(), global.nconf.get('upload_path'), path.basename(oldpicture)); fs.unlink(absolutePath, function(err) { if(err) { - winston.error('[%d] %s', Date.now(), + err); + winston.err(err); } uploadUserPicture(req.user.uid, path.extname(req.files.userPhoto.name), req.files.userPhoto.path, res); @@ -174,7 +174,7 @@ var user = require('./../user.js'), height: 128 }, function(err, stdout, stderr){ if (err) { - winston.err(err.message, err.stack); + winston.err(err); } res.json({ path: imageUrl }); @@ -183,7 +183,7 @@ var user = require('./../user.js'), os.on('error', function(err) { fs.unlinkSync(tempPath); - winston.error('[%d] %s', Date.now(), + err); + winston.err(err); }); is.pipe(os);