feature/recive-respuesta-de-vucem

This commit is contained in:
2026-04-06 15:53:25 -06:00
parent fe74481786
commit cc3942bbd7
3 changed files with 62 additions and 16 deletions

View File

@@ -432,11 +432,18 @@ async def upload_company_certificate(
detail=f"File type not allowed. Allowed: {', '.join(allowed_exts)}",
)
# Validar correspondencia extensión vs tipo (simple check)
if "cer" in certificate_type and file_ext != ".cer":
raise HTTPException(status_code=400, detail="For this certificate type, file must be .cer")
if "key" in certificate_type and file_ext != ".key":
raise HTTPException(status_code=400, detail="For this certificate type, file must be .key")
# Validar correspondencia extensión vs tipo (simple check, respetando sufijo)
ctype = (certificate_type or "").lower()
if ctype.endswith("_cer") and file_ext != ".cer":
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="For this certificate type, file must be .cer",
)
if ctype.endswith("_key") and file_ext != ".key":
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,
detail="For this certificate type, file must be .key",
)
# Validar tamaño
content = await file.read()