mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
breaking: remove deprecated uploads.delete
This commit is contained in:
@@ -30,7 +30,6 @@ SocketAdmin.email = require('./admin/email');
|
||||
SocketAdmin.analytics = require('./admin/analytics');
|
||||
SocketAdmin.logs = require('./admin/logs');
|
||||
SocketAdmin.errors = require('./admin/errors');
|
||||
SocketAdmin.uploads = require('./admin/uploads');
|
||||
SocketAdmin.digest = require('./admin/digest');
|
||||
SocketAdmin.cache = require('./admin/cache');
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
@@ -29,7 +29,7 @@ describe('authentication', () => {
|
||||
|
||||
it('should allow login with email for uid 1', async () => {
|
||||
const oldValue = meta.config.allowLoginWith;
|
||||
meta.config.allowLoginWith = 'email';
|
||||
meta.config.allowLoginWith = 'username-email';
|
||||
const { res } = await helpers.loginUser('regular@nodebb.org', 'regularpwd');
|
||||
assert.strictEqual(res.statusCode, 200);
|
||||
meta.config.allowLoginWith = oldValue;
|
||||
@@ -37,7 +37,7 @@ describe('authentication', () => {
|
||||
|
||||
it('second user should fail to login with email since email is not confirmed', async () => {
|
||||
const oldValue = meta.config.allowLoginWith;
|
||||
meta.config.allowLoginWith = 'email';
|
||||
meta.config.allowLoginWith = 'username-email';
|
||||
const uid = await user.create({ username: '2nduser', password: '2ndpassword', email: '2nduser@nodebb.org' });
|
||||
const { res, body } = await helpers.loginUser('2nduser@nodebb.org', '2ndpassword');
|
||||
assert.strictEqual(res.statusCode, 403);
|
||||
|
||||
Reference in New Issue
Block a user