diff --git a/app/api/nextcloud/files/route.ts b/app/api/nextcloud/files/route.ts index 3b3d2178..6e699c02 100644 --- a/app/api/nextcloud/files/route.ts +++ b/app/api/nextcloud/files/route.ts @@ -45,7 +45,7 @@ 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/files/${credentials.username}/Private`; + const webdavURL = `${normalizedBaseURL}/remote.php/dav`; console.log('WebDAV URL:', webdavURL); const client = createClient({ @@ -56,12 +56,26 @@ export async function GET(request: Request) { }); // Construct the folder path - const folderPath = folder; + const folderPath = `files/${credentials.username}/Private/${folder}`; console.log('Full folder path:', folderPath); try { - // List files in the specified folder - const files = await client.getDirectoryContents(folderPath); + // List files in the specified folder with detailed properties + const files = await client.getDirectoryContents(folderPath, { + details: true, + data: ` + + + + + + + + + + + ` + }); console.log('Found files:', files.length); // Filter for .md files and format the response