This commit is contained in:
Lizandro Guarnizo
2026-02-06 09:38:36 -05:00
parent 8324a014c0
commit 276af13387
4 changed files with 35 additions and 2 deletions
+14
View File
@@ -176,6 +176,20 @@ if ($providedUrl) {
} else {
$token = getConfigFromDB('whatsapp_token', '');
$apiUrl = rtrim(getConfigFromDB('whatsapp_api_url', 'https://graph.facebook.com/v22.0/'), '/');
// Validar que mediaId no esté vacío antes de construir el endpoint
if (empty($mediaId) || !is_string($mediaId) || trim($mediaId) === '') {
media_log("Invalid or empty mediaId provided: " . var_export($mediaId, true));
http_response_code(400);
header('Content-Type: application/json; charset=utf-8');
echo json_encode([
'success' => false,
'error' => 'Invalid media ID',
'hint' => 'Media ID cannot be empty or invalid'
]);
exit;
}
$endpoint = "{$apiUrl}/{$mediaId}";
if (empty($token)) {