diff --git a/packages/server/router/index.ts b/packages/server/router/index.ts index e918dd2b..2c43041c 100644 --- a/packages/server/router/index.ts +++ b/packages/server/router/index.ts @@ -41,7 +41,7 @@ export default function buildBaseApi(app: HttpServer) { sendJson(res, json); }); - app.route(/\/api\/counters\/search\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/api\/counters\/search\/(?.*)/, 'GET', (req, res) => { try { const query = decodeURI(req.params.query) .replace(/[^a-z0-9A-Z]/, '') @@ -61,7 +61,7 @@ export default function buildBaseApi(app: HttpServer) { } }); - app.route(/\/api\/counters\/download\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/api\/counters\/download\/(?.*)/, 'GET', (req, res) => { const folderName = req.query.name; if (!folderName) { return sendJson(res, { @@ -121,7 +121,7 @@ export default function buildBaseApi(app: HttpServer) { } }); - app.route(/\/api\/counters\/open\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/api\/counters\/open\/(?.*)/, 'GET', (req, res) => { try { const folderName = req.params.name; if (!folderName) { @@ -166,7 +166,7 @@ export default function buildBaseApi(app: HttpServer) { } }); - app.route(/\/api\/counters\/delete\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/api\/counters\/delete\/(?.*)/, 'GET', (req, res) => { try { const folderName = req.params.name; if (!folderName) { @@ -222,7 +222,7 @@ export default function buildBaseApi(app: HttpServer) { }); }); - app.route(/\/images\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/images\/(?.*)/, 'GET', (req, res) => { fs.readFile( path.join(pkgAssetsPath, 'images', req.params.filePath), (err, content) => { diff --git a/packages/server/router/v1.ts b/packages/server/router/v1.ts index 1f556081..c7c8136b 100644 --- a/packages/server/router/v1.ts +++ b/packages/server/router/v1.ts @@ -21,7 +21,7 @@ export default function buildV1Api({ } }); - app.route(/\/Songs\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/Songs\/(?.*)/, 'GET', (req, res) => { const url = req.pathname || '/'; const osuInstances: any = Object.values( diff --git a/packages/server/router/v2.ts b/packages/server/router/v2.ts index 48500b48..86a03dd2 100644 --- a/packages/server/router/v2.ts +++ b/packages/server/router/v2.ts @@ -62,7 +62,7 @@ export default function buildV2Api({ sendJson(res, json); }); - app.route(/\/files\/beatmap\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/files\/beatmap\/(?.*)/, 'GET', (req, res) => { const url = req.pathname || '/'; const osuInstances: any = Object.values( @@ -87,7 +87,7 @@ export default function buildV2Api({ }); }); - app.route(/\/files\/skin\/(?.*)/, 'GET', (req, res) => { + app.route(/^\/files\/skin\/(?.*)/, 'GET', (req, res) => { const url = req.pathname || '/'; const osuInstances: any = Object.values(