breaking: remove deprecated uploads.delete

isekai-main
Barış Soner Uşaklı 3 years ago
parent eecd02fbee
commit c93d7fdbdd

@ -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);

Loading…
Cancel
Save