import: Allow import if pad does not yet exist
parent
ed6fcefb67
commit
831528e8bc
|
@ -62,11 +62,6 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
|||
// handle import requests
|
||||
args.app.use('/p/:pad/import', limiter);
|
||||
args.app.post('/p/:pad/import', async function(req, res, next) {
|
||||
if (!(await padManager.doesPadExists(req.params.pad))) {
|
||||
console.warn(`Someone tried to import into a pad that doesn't exist (${req.params.pad})`);
|
||||
return next();
|
||||
}
|
||||
|
||||
const {session: {user} = {}} = req;
|
||||
const {accessStatus, authorID} = await securityManager.checkAccess(
|
||||
req.params.pad, req.cookies.sessionID, req.cookies.token, req.cookies.password, user);
|
||||
|
|
|
@ -211,16 +211,6 @@ describe('Imports and Exports', function(){
|
|||
.expect(/<ul class="bullet"><li><ul class="bullet"><li>hello<\/ul><\/li><\/ul>/);
|
||||
});
|
||||
|
||||
it('tries to import Plain Text to a pad that does not exist', async function() {
|
||||
const padId = testPadId + testPadId + testPadId;
|
||||
await agent.post(`/p/${padId}/import`)
|
||||
.attach('file', padText, {filename: '/test.txt', contentType: 'text/plain'})
|
||||
.expect(405);
|
||||
await agent.get(endPoint('getText') + `&padID=${padId}`)
|
||||
.expect(200)
|
||||
.expect((res) => assert.equal(res.body.code, 1));
|
||||
});
|
||||
|
||||
it('Tries to import unsupported file type', async function() {
|
||||
settings.allowUnknownFileEnds = false;
|
||||
await agent.post(`/p/${testPadId}/import`)
|
||||
|
|
Loading…
Reference in New Issue