fix: avatar/logo display diagnostics and upload error handling
All checks were successful
Build and Push Docker Image / build (push) Successful in 8m31s

Add error logging to silent catch blocks in avatar/logo URL generation,
show user avatar on admin member detail page, and surface specific error
messages for upload failures (CORS/network issues) instead of generic errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-05 02:11:16 +01:00
parent 335c736219
commit 78334676d0
7 changed files with 63 additions and 35 deletions

View File

@@ -139,16 +139,23 @@ export function AvatarUpload({
})
// Upload cropped blob directly to storage
const uploadResponse = await fetch(uploadUrl, {
method: 'PUT',
body: croppedBlob,
headers: {
'Content-Type': 'image/jpeg',
},
})
let uploadResponse: Response
try {
uploadResponse = await fetch(uploadUrl, {
method: 'PUT',
body: croppedBlob,
headers: {
'Content-Type': 'image/jpeg',
},
})
} catch (fetchError) {
console.error('Avatar upload network error (possible CORS issue):', fetchError)
throw new Error('Network error uploading file. The storage server may not be reachable.')
}
if (!uploadResponse.ok) {
throw new Error('Failed to upload file')
console.error('Avatar upload failed:', uploadResponse.status, uploadResponse.statusText)
throw new Error(`Upload failed (${uploadResponse.status}). Please try again.`)
}
// Confirm upload

View File

@@ -142,16 +142,23 @@ export function LogoUpload({
})
// Upload cropped blob directly to storage
const uploadResponse = await fetch(uploadUrl, {
method: 'PUT',
body: croppedBlob,
headers: {
'Content-Type': 'image/png',
},
})
let uploadResponse: Response
try {
uploadResponse = await fetch(uploadUrl, {
method: 'PUT',
body: croppedBlob,
headers: {
'Content-Type': 'image/png',
},
})
} catch (fetchError) {
console.error('Logo upload network error (possible CORS issue):', fetchError)
throw new Error('Network error uploading file. The storage server may not be reachable.')
}
if (!uploadResponse.ok) {
throw new Error('Failed to upload file')
console.error('Logo upload failed:', uploadResponse.status, uploadResponse.statusText)
throw new Error(`Upload failed (${uploadResponse.status}). Please try again.`)
}
// Confirm upload with the provider type that was used

View File

@@ -128,14 +128,21 @@ export function ProjectLogoUpload({
contentType: 'image/png',
})
const uploadResponse = await fetch(uploadUrl, {
method: 'PUT',
body: croppedBlob,
headers: { 'Content-Type': 'image/png' },
})
let uploadResponse: Response
try {
uploadResponse = await fetch(uploadUrl, {
method: 'PUT',
body: croppedBlob,
headers: { 'Content-Type': 'image/png' },
})
} catch (fetchError) {
console.error('Logo upload network error (possible CORS issue):', fetchError)
throw new Error('Network error uploading file. The storage server may not be reachable.')
}
if (!uploadResponse.ok) {
throw new Error('Failed to upload file')
console.error('Logo upload failed:', uploadResponse.status, uploadResponse.statusText)
throw new Error(`Upload failed (${uploadResponse.status}). Please try again.`)
}
await confirmUpload.mutateAsync({ projectId, key, providerType })