[READ-ONLY] a fast, modern browser for the npm registry

fix: badge label with empty string should not occupy width (#1095)

authored by

btea and committed by
GitHub
6bbbd85c 1419fc73

+1 -1
+1 -1
server/api/registry/badge/[type]/[...pkg].get.ts
··· 292 292 const rawLabelColor = labelColor ?? '#0a0a0a' 293 293 const finalLabelColor = rawLabelColor?.startsWith('#') ? rawLabelColor : `#${rawLabelColor}` 294 294 295 - const leftWidth = measureTextWidth(finalLabel) 295 + const leftWidth = finalLabel.trim().length === 0 ? 0 : measureTextWidth(finalLabel) 296 296 const rightWidth = measureTextWidth( 297 297 finalValue, 298 298 CHARS_WIDTH[strategyKey as keyof typeof CHARS_WIDTH],