fix(dashboard): clamp API key mask length for short keys

"•".repeat(apiKey.length - 8) threw RangeError when the key was
shorter than 8 chars, crashing the media-provider detail page.
This commit is contained in:
fasilu authored and decolua committed 2026-08-28 16:53:14 +07:00
1 parent 4a371d1d9f
commit bb3cb43e09
3 files changed
+3 -3

No files matched your search

@@ -157,7 +157,7 @@ export function SttExampleCard({ providerId }) {
{/* API Key */}
<Row label="API Key">
<span className="px-3 py-1.5 text-sm font-mono text-text-main bg-sidebar rounded-lg truncate block">
{apiKey ? `${apiKey.slice(0, 8)}${"\u2022".repeat(Math.min(20, apiKey.length - 8))}` : <span className="text-text-muted italic">No key configured</span>}
{apiKey ? `${apiKey.slice(0, 8)}${"\u2022".repeat(Math.min(20, Math.max(0, apiKey.length - 8)))}` : <span className="text-text-muted italic">No key configured</span>}
</span>
</Row>