From c19035bbde7a36c73c6751c5419fc6ec10004016 Mon Sep 17 00:00:00 2001 From: Jacob <46667568+jacobvd0@users.noreply.github.com> Date: Tue, 4 Apr 2023 13:53:17 +0930 Subject: [PATCH 1/3] Stop directories with empty names being created --- src/http/api/routes/directory/create.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/http/api/routes/directory/create.js b/src/http/api/routes/directory/create.js index 182bf45..24765f0 100644 --- a/src/http/api/routes/directory/create.js +++ b/src/http/api/routes/directory/create.js @@ -18,6 +18,10 @@ module.exports.opts = { } module.exports.handler = async (req, reply) => { - const directory = await db.createDirectoryOrFile(req.body) - reply.send(directory) + if (req.body.name != "") { + const directory = await db.createDirectoryOrFile(req.body) + reply.send(directory) + } else { + reply.send('Directory name is empty') + } } From c177eff859b8f04812e9de7ca41811b2a4957ae3 Mon Sep 17 00:00:00 2001 From: Jacob <46667568+jacobvd0@users.noreply.github.com> Date: Wed, 28 Jun 2023 17:14:36 +0930 Subject: [PATCH 2/3] Throw a bad request error when directory name is empty --- src/http/api/routes/directory/create.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/http/api/routes/directory/create.js b/src/http/api/routes/directory/create.js index 24765f0..517aab2 100644 --- a/src/http/api/routes/directory/create.js +++ b/src/http/api/routes/directory/create.js @@ -1,4 +1,5 @@ const HTTP_CODE = require('../../constants/httpCode') +const { throwHttpError } = require('../../utils/Util') const db = require('../../services/database') module.exports.opts = { @@ -13,6 +14,7 @@ module.exports.opts = { }, response: { [HTTP_CODE.OK]: { $ref: 'Directory#' }, + [HTTP_CODE.BAD_REQUEST]: { $ref: 'CommonError#' }, }, }, } @@ -22,6 +24,6 @@ module.exports.handler = async (req, reply) => { const directory = await db.createDirectoryOrFile(req.body) reply.send(directory) } else { - reply.send('Directory name is empty') + throwHttpError('Directory name is empty', HTTP_CODE.BAD_REQUEST) } } From b5c1f3cadf72f8f6e40979606cffddf7d258cbd5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:13:37 +0000 Subject: [PATCH 3/3] build(deps): bump undici from 5.19.1 to 5.26.3 Bumps [undici](https://github.com/nodejs/undici) from 5.19.1 to 5.26.3. - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](https://github.com/nodejs/undici/compare/v5.19.1...v5.26.3) --- updated-dependencies: - dependency-name: undici dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 65 +++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7fc2cbe..af7ac58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -670,17 +670,6 @@ "node": ">=4" } }, - "node_modules/busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "dependencies": { - "streamsearch": "^1.1.0" - }, - "engines": { - "node": ">=10.16.0" - } - }, "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -3082,14 +3071,6 @@ "node": ">=4.0.0" } }, - "node_modules/streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -3362,14 +3343,22 @@ } }, "node_modules/undici": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.19.1.tgz", - "integrity": "sha512-YiZ61LPIgY73E7syxCDxxa3LV2yl3sN8spnIuTct60boiiRaE1J8mNWHO8Im2Zi/sFrPusjLlmRPrsyraSqX6A==", + "version": "5.26.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.3.tgz", + "integrity": "sha512-H7n2zmKEWgOllKkIUkLvFmsJQj062lSm3uA4EYApG8gLuiOM0/go9bIoC3HVaSnfg4xunowDE2i9p8drkXuvDw==", "dependencies": { - "busboy": "^1.6.0" + "@fastify/busboy": "^2.0.0" }, "engines": { - "node": ">=12.18" + "node": ">=14.0" + } + }, + "node_modules/undici/node_modules/@fastify/busboy": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz", + "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==", + "engines": { + "node": ">=14" } }, "node_modules/uri-js": { @@ -3973,14 +3962,6 @@ "resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz", "integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==" }, - "busboy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", - "integrity": "sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==", - "requires": { - "streamsearch": "^1.1.0" - } - }, "call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", @@ -5783,11 +5764,6 @@ "resolved": "https://registry.npmjs.org/stream-wormhole/-/stream-wormhole-1.1.0.tgz", "integrity": "sha512-gHFfL3px0Kctd6Po0M8TzEvt3De/xu6cnRrjlfYNhwbhLPLwigI2t1nc6jrzNuaYg5C4YF78PPFuQPzRiqn9ew==" }, - "streamsearch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", - "integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==" - }, "string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -5993,11 +5969,18 @@ } }, "undici": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-5.19.1.tgz", - "integrity": "sha512-YiZ61LPIgY73E7syxCDxxa3LV2yl3sN8spnIuTct60boiiRaE1J8mNWHO8Im2Zi/sFrPusjLlmRPrsyraSqX6A==", + "version": "5.26.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.3.tgz", + "integrity": "sha512-H7n2zmKEWgOllKkIUkLvFmsJQj062lSm3uA4EYApG8gLuiOM0/go9bIoC3HVaSnfg4xunowDE2i9p8drkXuvDw==", "requires": { - "busboy": "^1.6.0" + "@fastify/busboy": "^2.0.0" + }, + "dependencies": { + "@fastify/busboy": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.0.0.tgz", + "integrity": "sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ==" + } } }, "uri-js": {