mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-06 05:55:48 +01:00
another fix to path in image upload
This commit is contained in:
@@ -131,11 +131,11 @@ var user = require('./../user.js'),
|
|||||||
return;
|
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) {
|
fs.unlink(absolutePath, function(err) {
|
||||||
if(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);
|
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
|
height: 128
|
||||||
}, function(err, stdout, stderr){
|
}, function(err, stdout, stderr){
|
||||||
if (err) {
|
if (err) {
|
||||||
winston.err(err.message, err.stack);
|
winston.err(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json({ path: imageUrl });
|
res.json({ path: imageUrl });
|
||||||
@@ -183,7 +183,7 @@ var user = require('./../user.js'),
|
|||||||
|
|
||||||
os.on('error', function(err) {
|
os.on('error', function(err) {
|
||||||
fs.unlinkSync(tempPath);
|
fs.unlinkSync(tempPath);
|
||||||
winston.error('[%d] %s', Date.now(), + err);
|
winston.err(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
is.pipe(os);
|
is.pipe(os);
|
||||||
|
|||||||
Reference in New Issue
Block a user