From 8cf3b89f91cb04009c5203f3fa9c757aae75ee05 Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Tue, 26 Mar 2019 09:32:44 -0700 Subject: [PATCH] increase file id to 8 bytes --- server/routes/index.js | 2 +- server/routes/upload.js | 2 +- server/routes/ws.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/routes/index.js b/server/routes/index.js index bef01efe..de12a613 100644 --- a/server/routes/index.js +++ b/server/routes/index.js @@ -11,7 +11,7 @@ const filelist = require('./filelist'); const clientConstants = require('../clientConstants'); const IS_DEV = config.env === 'development'; -const ID_REGEX = '([0-9a-fA-F]{10})'; +const ID_REGEX = '([0-9a-fA-F]{10,16})'; module.exports = function(app) { app.set('trust proxy', true); diff --git a/server/routes/upload.js b/server/routes/upload.js index c190a5f7..7f16410a 100644 --- a/server/routes/upload.js +++ b/server/routes/upload.js @@ -8,7 +8,7 @@ const { encryptedSize } = require('../../app/utils'); const log = mozlog('send.upload'); module.exports = async function(req, res) { - const newId = crypto.randomBytes(5).toString('hex'); + const newId = crypto.randomBytes(8).toString('hex'); const metadata = req.header('X-File-Metadata'); const auth = req.header('Authorization'); if (!metadata || !auth) { diff --git a/server/routes/ws.js b/server/routes/ws.js index b5fc4630..bd0ebb28 100644 --- a/server/routes/ws.js +++ b/server/routes/ws.js @@ -23,7 +23,7 @@ module.exports = function(ws, req) { ws.once('message', async function(message) { try { - const newId = crypto.randomBytes(5).toString('hex'); + const newId = crypto.randomBytes(8).toString('hex'); const owner = crypto.randomBytes(10).toString('hex'); const fileInfo = JSON.parse(message);