From 9d232cc5cf52939963c7a23c8f1d45c0ac6be745 Mon Sep 17 00:00:00 2001 From: alma Date: Sun, 20 Apr 2025 16:54:58 +0200 Subject: [PATCH] carnet panel2 --- app/api/nextcloud/files/route.ts | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/app/api/nextcloud/files/route.ts b/app/api/nextcloud/files/route.ts index 6e699c02..db7c3d20 100644 --- a/app/api/nextcloud/files/route.ts +++ b/app/api/nextcloud/files/route.ts @@ -45,37 +45,19 @@ export async function GET(request: Request) { const normalizedBaseURL = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL; // Construct the full WebDAV URL - const webdavURL = `${normalizedBaseURL}/remote.php/dav`; + const webdavURL = `${normalizedBaseURL}/remote.php/dav/files/${credentials.username}/Private/${folder}`; console.log('WebDAV URL:', webdavURL); const client = createClient({ username: credentials.username, password: credentials.password, - baseURL: webdavURL, + baseURL: normalizedBaseURL, authType: 'basic', }); - // Construct the folder path - const folderPath = `files/${credentials.username}/Private/${folder}`; - console.log('Full folder path:', folderPath); - try { - // List files in the specified folder with detailed properties - const files = await client.getDirectoryContents(folderPath, { - details: true, - data: ` - - - - - - - - - - - ` - }); + // List files in the specified folder + const files = await client.getDirectoryContents(`/remote.php/dav/files/${credentials.username}/Private/${folder}`); console.log('Found files:', files.length); // Filter for .md files and format the response