diff --git a/server/portal_server.js b/server/portal_server.js index 4cb60008..7bdebc1d 100644 --- a/server/portal_server.js +++ b/server/portal_server.js @@ -139,7 +139,7 @@ app.post('/delete/:id', (req, res) => { app.post('/upload', (req, res, next) => { const newId = crypto.randomBytes(5).toString('hex'); - let meta = JSON.parse(req.header('X-File-Metadata')); + const meta = JSON.parse(req.header('X-File-Metadata')); meta.delete = crypto.randomBytes(10).toString('hex'); log.info('meta', meta); req.pipe(req.busboy); @@ -177,8 +177,4 @@ app.listen(conf.listen_port, () => { const validateID = route_id => { return route_id.match(/^[0-9a-fA-F]{10}$/) !== null; -}; - -const validateIV = route_id => { - return route_id.match(/^[0-9a-fA-F]{24}$/) !== null; -}; +}; \ No newline at end of file diff --git a/server/storage.js b/server/storage.js index a4f9b673..e765b0c7 100644 --- a/server/storage.js +++ b/server/storage.js @@ -4,7 +4,6 @@ const s3 = new AWS.S3(); const conf = require('./config.js'); const fs = require('fs'); const path = require('path'); -const crypto = require('crypto'); const mozlog = require('./log.js'); diff --git a/test/aws.storage.test.js b/test/aws.storage.test.js index dc19d5fc..867c2009 100644 --- a/test/aws.storage.test.js +++ b/test/aws.storage.test.js @@ -112,11 +112,8 @@ describe('Testing Set using aws', function() { sinon.stub(crypto, 'randomBytes').returns(buf); s3Stub.upload.callsArgWith(1, null, {}); return storage - .set('123', {}, 'Filename.moz', {}) - .then(([deleteKey, id]) => { - assert.equal(deleteKey, buf.toString('hex')); - assert.notEqual(id, null); - assert.notEqual(deleteKey, null); + .set('123', '123', {}, 'Filename.moz', {}) + .then(() => { assert(expire.calledOnce); assert(expire.calledWith('123', 86400000)); }) diff --git a/test/local.storage.test.js b/test/local.storage.test.js index d965d8cc..022cf613 100644 --- a/test/local.storage.test.js +++ b/test/local.storage.test.js @@ -122,9 +122,9 @@ describe('Testing Set to local filesystem', function() { fsStub.createWriteStream.returns({ on: stub }); return storage - .set('test', { pipe: sinon.stub() }, 'Filename.moz', {}) - .then(deleteKey => { - assert(deleteKey); + .set('test', 'test', { pipe: sinon.stub() }, 'Filename.moz', {}) + .then(() => { + assert(1); }) .catch(err => assert.fail()); });