From 7270caccae84d8185fd49e92e1eec19506890899 Mon Sep 17 00:00:00 2001 From: Qi Zhao <956361916@qq.com> Date: Thu, 13 Jun 2024 23:28:22 +0800 Subject: [PATCH] Update server/routers/api-router.js Co-authored-by: Frank Elsinga --- server/routers/api-router.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/routers/api-router.js b/server/routers/api-router.js index c33ef78c1..6bc4b91ee 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -313,8 +313,8 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request, let requestedDuration = request.params.duration !== undefined ? request.params.duration : "24"; const overrideValue = value && parseFloat(value); - if (isNumeric(requestedDuration)) { // all numeric only - requestedDuration = `${requestedDuration}${durationUnits.HOUR}`; + if (/^[0-9]+$/.test(requestedDuration)) { + requestedDuration = `${requestedDuration}h`; } const duration = requestedDuration.slice(0, -1);