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:
@@ -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 &&
|
||||
|
||||
Reference in New Issue
Block a user