diff --git a/app/api/nextcloud/status/route.ts b/app/api/nextcloud/status/route.ts index 7c6dce8c..45ad01e3 100644 --- a/app/api/nextcloud/status/route.ts +++ b/app/api/nextcloud/status/route.ts @@ -41,22 +41,37 @@ export async function GET() { console.log('Requesting WebDAV URL:', webdavUrl); // Get all cookies from the request - const cookieHeader = cookieStore.getAll() + const allCookies = cookieStore.getAll(); + console.log('Available cookies:', allCookies.map(c => ({ + name: c.name, + value: c.value.substring(0, 10) + '...', // Log partial value for security + domain: c.domain, + path: c.path, + secure: c.secure, + httpOnly: c.httpOnly, + sameSite: c.sameSite + }))); + + const cookieHeader = allCookies .map(cookie => `${cookie.name}=${cookie.value}`) .join('; '); + console.log('Sending cookie header:', cookieHeader.substring(0, 100) + '...'); // Log partial header + const foldersResponse = await fetch(webdavUrl, { headers: { 'Cookie': cookieHeader, 'Depth': '1', 'Content-Type': 'application/xml', }, + credentials: 'include', // Important for cookie handling }); if (!foldersResponse.ok) { const errorText = await foldersResponse.text(); console.error('Failed to fetch folders. Status:', foldersResponse.status); console.error('Response:', errorText); + console.error('Response headers:', Object.fromEntries(foldersResponse.headers.entries())); throw new Error(`Failed to fetch folders: ${errorText}`); }