From 062cb053cc3861273445f596d7e3df74468903ad Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 18 Nov 2023 12:55:01 +0200 Subject: [PATCH] fix: crash on tag round() with >100 decimals --- backend/src/templateFormatter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/templateFormatter.ts b/backend/src/templateFormatter.ts index 11c17925..abe42fe0 100644 --- a/backend/src/templateFormatter.ts +++ b/backend/src/templateFormatter.ts @@ -419,7 +419,7 @@ const baseValues = { }, round(arg, decimals = 0) { if (isNaN(arg)) return 0; - return decimals === 0 ? Math.round(arg) : arg.toFixed(decimals); + return decimals === 0 ? Math.round(arg) : arg.toFixed(Math.max(0, Math.min(decimals, 100))); }, add(...args) { return args.reduce((result, arg) => {