Commit 95be7796 authored by Mahmoud Aglan's avatar Mahmoud Aglan

fix: append apikey to avatar public URL for self-hosted Supabase

Self-hosted Supabase Kong requires apikey param even for public bucket
URLs. Without it, browsers get 401 when loading the image.
Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent bd8edd8d
...@@ -94,7 +94,7 @@ if ($httpCode >= 400) { ...@@ -94,7 +94,7 @@ if ($httpCode >= 400) {
jsonError('Storage error (' . $httpCode . '): ' . ($decoded['message'] ?? $decoded['error'] ?? $response), 500); jsonError('Storage error (' . $httpCode . '): ' . ($decoded['message'] ?? $decoded['error'] ?? $response), 500);
} }
$publicUrl = SUPABASE_STORAGE . '/object/public/' . $bucket . '/' . $storagePath; $publicUrl = SUPABASE_STORAGE . '/object/public/' . $bucket . '/' . $storagePath . '?apikey=' . SUPABASE_ANON_KEY;
$db = supabaseService(); $db = supabaseService();
$result = $db->update('profiles', ['avatar_url' => $publicUrl], ['id' => 'eq.' . $userId]); $result = $db->update('profiles', ['avatar_url' => $publicUrl], ['id' => 'eq.' . $userId]);
......
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