diff --git a/app/carnet/page.tsx b/app/carnet/page.tsx index d5bfb661..a3e8f66c 100644 --- a/app/carnet/page.tsx +++ b/app/carnet/page.tsx @@ -144,12 +144,19 @@ export default function CarnetPage() { // For contacts, parse the VCF files const parsedContacts = await Promise.all( data.map(async (file: any) => { - const contentResponse = await fetch(`/api/nextcloud/files/content?id=${file.filename}`); - if (contentResponse.ok) { - const content = await contentResponse.text(); - return parseVCard(content); + try { + // Use the full filename for fetching content + const contentResponse = await fetch(`/api/nextcloud/files/content?path=${encodeURIComponent(file.filename)}`); + if (contentResponse.ok) { + const content = await contentResponse.text(); + return parseVCard(content); + } + console.error('Failed to fetch VCF content:', contentResponse.status); + return null; + } catch (error) { + console.error('Error fetching VCF content:', error); + return null; } - return null; }) ); setContacts(parsedContacts.filter(Boolean));