diff --git a/app/api/nextcloud/status/route.ts b/app/api/nextcloud/status/route.ts index e07dbafd..d79ad054 100644 --- a/app/api/nextcloud/status/route.ts +++ b/app/api/nextcloud/status/route.ts @@ -53,7 +53,7 @@ async function parseXMLResponse(response: Response): Promise { async function createFolder(nextcloudUrl: string, username: string, password: string, folderPath: string) { try { // First check if folder exists - const checkResponse = await fetch(`${nextcloudUrl}/remote.php/dav/files/${encodeURIComponent(username)}/${encodeURIComponent(folderPath)}`, { + const checkResponse = await fetch(`${nextcloudUrl}/remote.php/dav/files/${encodeURIComponent(username)}/${folderPath}`, { method: 'PROPFIND', headers: { 'Authorization': `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`, @@ -67,7 +67,7 @@ async function createFolder(nextcloudUrl: string, username: string, password: st } // If folder doesn't exist, create it - const response = await fetch(`${nextcloudUrl}/remote.php/dav/files/${encodeURIComponent(username)}/${encodeURIComponent(folderPath)}`, { + const response = await fetch(`${nextcloudUrl}/remote.php/dav/files/${encodeURIComponent(username)}/${folderPath}`, { method: 'MKCOL', headers: { 'Authorization': `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`, @@ -79,7 +79,8 @@ async function createFolder(nextcloudUrl: string, username: string, password: st console.error(`Failed to create folder ${folderPath}:`, { status: response.status, statusText: response.statusText, - error: errorText + error: errorText, + url: `${nextcloudUrl}/remote.php/dav/files/${encodeURIComponent(username)}/${folderPath}` }); throw new Error(`Failed to create folder ${folderPath}: ${response.status} ${response.statusText}`); }