mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-25 03:10:10 +02:00
closes #6576
This commit is contained in:
@@ -167,7 +167,7 @@ file.delete = function (path, callback) {
|
||||
}
|
||||
fs.unlink(path, function (err) {
|
||||
if (err) {
|
||||
winston.error(err);
|
||||
winston.warn(err);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
var async = require('async');
|
||||
var path = require('path');
|
||||
var nconf = require('nconf');
|
||||
var winston = require('winston');
|
||||
|
||||
var db = require('../database');
|
||||
var file = require('../file');
|
||||
@@ -26,7 +27,14 @@ module.exports = function (User) {
|
||||
return next(new Error('[[error:no-privileges]]'));
|
||||
}
|
||||
|
||||
file.delete(path.join(nconf.get('upload_path'), uploadName), next);
|
||||
winston.verbose('[user/deleteUpload] Deleting ' + uploadName);
|
||||
async.parallel([
|
||||
async.apply(file.delete, path.join(nconf.get('upload_path'), uploadName)),
|
||||
async.apply(file.delete, path.join(nconf.get('upload_path'), path.dirname(uploadName), path.basename(uploadName, path.extname(uploadName)) + '-resized' + path.extname(uploadName))),
|
||||
], function (err) {
|
||||
// Only return err, not the parallel'd result set
|
||||
next(err);
|
||||
});
|
||||
},
|
||||
function (next) {
|
||||
db.sortedSetRemove('uid:' + uid + ':uploads', uploadName, next);
|
||||
|
||||
Reference in New Issue
Block a user