feature/recive-respuesta-de-vucem
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user