Skip to content

Commit d78ca75

Browse files
authored
fix: fix fallback not triggered for 0 measuredWidth (#1584)
1 parent 2ba1c5e commit d78ca75

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/api/registry/badge/[type]/[...pkg].get.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function measureTextWidth(text: string, font: string): number | null {
6969

7070
const measuredWidth = context.measureText(text).width
7171

72-
if (!Number.isNaN(measuredWidth)) {
72+
if (Number.isFinite(measuredWidth) && measuredWidth > 0) {
7373
return Math.ceil(measuredWidth)
7474
}
7575
}

0 commit comments

Comments
 (0)