mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-17 18:10:42 +01:00
breaking: remove deprecated uploads.delete
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const nconf = require('nconf');
|
||||
|
||||
const sockets = require('..');
|
||||
|
||||
const Uploads = module.exports;
|
||||
|
||||
Uploads.delete = function (socket, pathToFile, callback) {
|
||||
sockets.warnDeprecated(socket, 'DELETE /api/v3/files');
|
||||
|
||||
pathToFile = path.join(nconf.get('upload_path'), pathToFile);
|
||||
if (!pathToFile.startsWith(nconf.get('upload_path'))) {
|
||||
return callback(new Error('[[error:invalid-path]]'));
|
||||
}
|
||||
|
||||
fs.unlink(pathToFile, callback);
|
||||
};
|
||||
Reference in New Issue
Block a user