From 30f054090fe985cfaf44546057dcd4474688848d Mon Sep 17 00:00:00 2001 From: Michael Shanks Date: Sun, 14 Jun 2020 20:36:51 +0100 Subject: [PATCH] code review - static controller - test app id with regex --- packages/server/src/api/controllers/static.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/server/src/api/controllers/static.js b/packages/server/src/api/controllers/static.js index d2d2596c0a..82545d459c 100644 --- a/packages/server/src/api/controllers/static.js +++ b/packages/server/src/api/controllers/static.js @@ -66,9 +66,4 @@ exports.serveComponentLibrary = async function(ctx) { await send(ctx, "/index.js", { root: componentLibraryPath }) } -const looksLikeAppId = appId => { - const allowedChars = "0123456789abcdef".split("") - return ( - appId.length === 32 && !appId.split("").some(c => allowedChars.includes(c)) - ) -} +const looksLikeAppId = appId => /^[0-9a-f]{32}$/.test(appId)