mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-04 21:15:55 +01:00
fixed image upload, delete temp file if there is error
This commit is contained in:
@@ -152,7 +152,7 @@ var user = require('./../user.js'),
|
||||
}
|
||||
|
||||
var filename = uid + '-profileimg' + extension;
|
||||
var uploadPath = path.join(__dirname, '../', global.nconf.get('upload_path'), filename);
|
||||
var uploadPath = path.join(process.cwd(), global.nconf.get('upload_path'), filename);
|
||||
|
||||
winston.info('Attempting upload to: '+ uploadPath);
|
||||
|
||||
@@ -179,10 +179,10 @@ var user = require('./../user.js'),
|
||||
|
||||
res.json({ path: imageUrl });
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
os.on('error', function(err) {
|
||||
fs.unlinkSync(tempPath);
|
||||
winston.error('[%d] %s', Date.now(), + err);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user