fix: melhorar validação de URL do logo do cartão

- Verificar se logo começa com /, http:// ou https://
- Prevenir erro com logos que são apenas nomes de arquivo
- Exibir fallback quando logo não é uma URL válida
This commit is contained in:
Claude
2025-11-16 16:58:20 +00:00
parent 3f95ea4655
commit 6da03b43f6

View File

@@ -34,8 +34,13 @@ export function InstallmentGroupCard({
const unpaidCount = unpaidInstallments.length;
// Validar se o logo é uma URL válida
const isValidLogo = group.cartaoLogo && group.cartaoLogo.trim().length > 0;
// Validar se o logo é uma URL válida (deve começar com / ou http:// ou https://)
const isValidLogo =
group.cartaoLogo &&
group.cartaoLogo.trim().length > 0 &&
(group.cartaoLogo.startsWith('/') ||
group.cartaoLogo.startsWith('http://') ||
group.cartaoLogo.startsWith('https://'));
const isFullySelected =
selectedInstallments.size === unpaidInstallments.length &&