Commit ca122ef4 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: remove group_name from platform_assets insert — column doesn't exist

The platform_assets table has no group_name column (unlike platform_theme).
This was causing all emoji uploads from admin to silently fail with HTTP 400.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent ef6b1d98
...@@ -96,19 +96,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['asset'])) { ...@@ -96,19 +96,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['asset'])) {
$theme['assets'][$slot] = $publicUrl; $theme['assets'][$slot] = $publicUrl;
// Save asset URL to Supabase platform_assets table (upsert) // Save asset URL to Supabase platform_assets table (upsert)
$assetData = [
'id' => $slot,
'category' => 'custom',
'group_name' => 'player_app',
'label' => $slot,
'asset_url' => $publicUrl,
'dimensions' => $expectedW . 'x' . $expectedH
];
$existing = $sdb->get('platform_assets', ['id' => 'eq.' . $slot, 'select' => 'id', 'limit' => 1]); $existing = $sdb->get('platform_assets', ['id' => 'eq.' . $slot, 'select' => 'id', 'limit' => 1]);
if (!empty($existing) && !isset($existing['error'])) { if (!empty($existing) && !isset($existing['error'])) {
$result = $sdb->update('platform_assets', ['asset_url' => $publicUrl, 'dimensions' => $expectedW . 'x' . $expectedH], ['id' => 'eq.' . $slot]); $result = $sdb->update('platform_assets', ['asset_url' => $publicUrl, 'dimensions' => $expectedW . 'x' . $expectedH], ['id' => 'eq.' . $slot]);
} else { } else {
$result = $sdb->insert('platform_assets', $assetData); $result = $sdb->insert('platform_assets', ['id' => $slot, 'category' => 'custom', 'label' => $slot, 'asset_url' => $publicUrl, 'dimensions' => $expectedW . 'x' . $expectedH]);
} }
if (isset($result['error'])) { if (isset($result['error'])) {
error_log('[branding] platform_assets save failed: ' . json_encode($result)); error_log('[branding] platform_assets save failed: ' . json_encode($result));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment