carnet panel2

This commit is contained in:
alma 2025-04-20 16:47:15 +02:00
parent e64a54c929
commit 947d3f048f

View File

@ -47,13 +47,15 @@ export async function GET(request: Request) {
const client = createClient({
username: credentials.username,
password: credentials.password,
baseURL: normalizedBaseURL,
baseURL: `${normalizedBaseURL}/remote.php/dav/files/${credentials.username}/Private`,
authType: 'basic',
});
// Construct the folder path with leading slash
const folderPath = `/remote.php/dav/files/${credentials.username}/Private/${folder}`;
// Construct the folder path without leading slash
const folderPath = folder;
console.log('Full folder path:', folderPath);
try {
// List files in the specified folder
const files = await client.getDirectoryContents(folderPath);
console.log('Found files:', files.length);
@ -69,6 +71,10 @@ export async function GET(request: Request) {
}));
return NextResponse.json(markdownFiles);
} catch (error) {
console.error('Error listing directory contents:', error);
return NextResponse.json({ error: 'Failed to list directory contents' }, { status: 500 });
}
} catch (error) {
console.error('Error fetching files:', error);
return NextResponse.json({ error: 'Failed to fetch files' }, { status: 500 });