From 4ccf1b37e1506e523712355ea141b8635239d713 Mon Sep 17 00:00:00 2001 From: Yoshihiro OKUMURA Date: Tue, 15 Sep 2026 12:58:30 +0900 Subject: [PATCH] fix: append px only to bare numbers in CosmoDB image sizes The check was written /^d+/, which matches a literal d, so a unitless width or height in an {Image} tag never got its px and was dropped as invalid CSS. Anchor it at both ends so the 160px and 90% values the current templates use are left as they are. --- src/cosmodb/lib/CosmoDbContext.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cosmodb/lib/CosmoDbContext.ts b/src/cosmodb/lib/CosmoDbContext.ts index edca0ca..89e1820 100644 --- a/src/cosmodb/lib/CosmoDbContext.ts +++ b/src/cosmodb/lib/CosmoDbContext.ts @@ -537,11 +537,11 @@ class CosmoDbContext { } const imgStyles: string[] = []; if (options[0] !== '') { - const value = /^d+/.test(options[0]) ? `${options[0]}px` : options[0]; + const value = /^\d+$/.test(options[0]) ? `${options[0]}px` : options[0]; imgStyles.push(`width:${value}`); } if (options[1] !== '') { - const value = /^d+/.test(options[1]) ? `${options[1]}px` : options[1]; + const value = /^\d+$/.test(options[1]) ? `${options[1]}px` : options[1]; imgStyles.push(`height:${value}`); } const imgStyle = imgStyles.length !== 0 ? `style="${imgStyles.join(';')}" ` : '';